Local json file to neotable - Forum

Forum Navigation
You need to log in to create posts and topics.

Local json file to neotable

How can we make a table with local json file?

Uploaded files:
  • You need to login to have access to uploads.

@asmat I have found two problems:

JSON format should be something like this:

[{
"Id":1,
"Name":"nasir",
"Age":14
},
{
"Id":2,
"Name":"ali",
"Age":18
},
{
"Id":3,
"Name":"shamas",
"Age":15
},
{
"Id":4,
"Name":"kabir",
"Age":16
}]

Also you must parse the data before sending it to neoTable:

ConsoleLog [content]
ParseJSON "[content]" [contentjson]
neoTableSetColumn "Container1" 1 "Id" "ID" "" false false false ""
neoTableSetColumn "Container1" 2 "Name" "Name" "" false false false ""
neoTableSetColumn "Container1" 3 "Age" "Age" "" false false false ""
neoTableInitTable "Container1" "" 0 "Table" false false false false false ""
neoTableLoadData "Container1" [contentjson]

Take a look at the attached fixed sample.

Uploaded files:
  • You need to login to have access to uploads.
Vadim and CN_Iceman have reacted to this post.
VadimCN_Iceman

Thank you so much master luishp!!

@luishp @asmat estoy intentado crear resgistros de datos para exportar a json. Queria crear una estructura tipo:

[{
"Id":1,
"Name":"nasir",
"Age":14
},
{
"Id":2,
"Name":"ali",
"Age":18
},
{
"Id":3,
"Name":"shamas",
"Age":15
},
{
"Id":4,
"Name":"kabir",
"Age":16
}]

Estoy probando con este método:

CreateEmptyObject [objeto]
SetVar [objeto('id')] [vid]
SetVar [objeto('namme')] [vname]

Pero no se como hacer para que añadir nuevos registros. La idea es crear como fichas de datos una por cada alumno.

Gracias.

Roger Rey

 

 

@rrey:

In order to add one record (row) to an existing Table, how about ...

neoTableInsertRow ... followed by ... neoTableGetAllData ?

... or were you asking about setting up an empty Table (i.e. 0 rows) to begin with ?

 

@gaev Me refiero a la creación de los array.

@rrey

I mean the creation of the arrays.

Try this ...

CreateEmptyArray [ArrayOfJSONs]

CreateEmptyObject [objeto]
SetVar [objeto('id')] 1
SetVar [objeto('namme')] "Andy"
SetVar [objeto('age')] 14
ArrayAddItem [ArrayOfJSONs] [objeto]

CreateEmptyObject [objeto]
SetVar [objeto('id')] 2
SetVar [objeto('namme')] "Briana"
SetVar [objeto('age')] 26
ArrayAddItem [ArrayOfJSONs] [objeto]

... verify length
ArrayLen [ArrayOfJSONs] [arrayLen]
AlertBox "array length" "[arrayLen]" ""

... verify first element
SetVar [thisNumber] 0
SetVar [thisJSON] [ArrayOfJSONs([thisNumber])]
StringifyJSON [thisJSON] [thisJSONString]
AlertBox "JSONString for element [thisNumber]" "[thisJSONString]" ""

Hope this is what you were looking for.

 

 

@rrey @gaev, just another possibility:

CreateEmptyArray [ArrayOfJSONs]

Loop 0 2 [n]
  CreateEmptyObject [ArrayOfJSONs([n])]
EndLoop

SetVar [ArrayOfJSONs(0).id] 1
SetVar [ArrayOfJSONs(0).name] "Andy"
SetVar [ArrayOfJSONs(0).age] 14

SetVar [ArrayOfJSONs(1).id] 2
SetVar [ArrayOfJSONs(1).name] "Ali"
SetVar [ArrayOfJSONs(1).age] 18

SetVar [ArrayOfJSONs(2).id] 3
SetVar [ArrayOfJSONs(2).name] "Shamas"
SetVar [ArrayOfJSONs(2).age] 15

Regards

@rrey echa un vistazo a este ejemplo también:
https://visualneo.com/forum/topic/angular-directives-ng-repeat

Saludos

@gaev @luishp muchas gracias por la ayuda. Justamente esto es lo que quería saber. Tampoco conocía el complemento neotable y la directiva ngRepeat. Con todo esto esto se pueden hacer muchas cosas y ayudan a VisualNeo como herramienta de desarrollo rápida.

 

Roger Rey