How do you get csv result from MySQL?

I have a little problem, I can't make my table D: appear, I get "The second argument to foreach is not a list. The second argument is: "Id,EDT,Actividades,HHProgramadas,HHGanadas,HHdesviadas,trabajo,Resumen 1,1,PROGRAMA CONSTRUCCIÓN PGP 2019"...


Proyecto_N2 (1).aia (155,9 KB)

How can it be done so that when entering data from a .csv to the tableviewer it does not jump from column to having a ' , ', for example,

| Description | ID |
| Removal of channeling | cables and support |

when it really should be

| Description | ID |
| Removal of channeling, cables and support | 10|

Your response content is a table in csv format... to get a list of lists use the list from csv table block

Taifun

but

MYSQL table:
Opera Captura de pantalla_2022-10-12_235559_databases-auth.000webhost.com
APP Table:


Label APP:

In the app table it occupies a space that it shouldn't due to the fact that it has a ','

This is not related to TableViewer any more.
I moved to a new thread.

1 Like

Show your mysql response content before you do anything to it, as text...

Taifun has already advised you to convert your csv table to an AI2 list

Also, we do appear to be going round in circles. I am certain we have covered this already in one of your other posts....

table.txt (50,5 KB)
this i have from response content

Id,EDT,Actividades,HHProgramadas,HHGanadas,HHdesviadas
1,1,PROGRAMA CONSTRUCCIÓN PGP 2019 ,0,2024.3000000000002,2024.3000000000002
2,1.1,   LINEA DE FIBRA,0,2024.3000000000002,2024.3000000000002
3,1.1.1,      ÁREA 331,0,2024.3000000000002,2024.3000000000002
4,1.1.1.1,         LINEA 2,0,280.3,280.3
5,1.1.1.1.1,            Grua Desatolladora,0,217.60000000000002,217.60000000000002
6,1.1.1.1.1.1,               Demolición dados cortina y construcción fundaciones

yes, this is also called a table in csv format as I already tried to explain... see my previous answer...

EDIT: and as you can see from the Do it result, there are spaces inside your values (before "Limpiar")

16,1.1.1.1.4.3,               Limpiar, pulir y rebaje en plancha transversal entre conexión entre transporte,0,0,0

you can remove these spaces using the trim block from the text drawer

Taifun

something like this?
Opera Captura de pantalla_2022-10-13_173026_ai2.appinventor.mit.edu

No... you have to select the corresponding list item, then you can remove leading spaces of that list item

See also the documentation MIT App Inventor Text Blocks

Alternatively make sure, that there are no leading spaces in your data on the server...

Taifun

In order to handle a comma within one of your fields, you will need to add double quotes around each field in your file, or simply remove any commas in fields in your data

e.g.

"14","1.1.1.1.4.1","               Inicio PGP19","0","0","0"
"15","1.1.1.1.4.2","               Montaje de plataforma de servicio","0","0","0"
"16","1.1.1.1.4.3","               Limpiar, pulir y rebaje en plancha transversal entre conexión entre transporte","0","0","0"
"17","1.1.1.1.4.4","               Montaje de cadenas","0","0","0"
"18","1.1.1.1.4.5","               Reparación de chute existente bajo power feed","0","0","0"

or

14,1.1.1.1.4.1,               Inicio PGP19,0,0,0
15,1.1.1.1.4.2,               Montaje de plataforma de servicio,0,0,0
16,1.1.1.1.4.3,               Limpiar pulir y rebaje en plancha transversal entre conexión entre transporte,0,0,0
17,1.1.1.1.4.4,               Montaje de cadenas,0,0,0
18,1.1.1.1.4.5,               Reparación de chute existente bajo power feed,0,0,0

which ever is going to be easiest.....as both will require some manual editing

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.