Flynet Viewer .NET Programmer's Reference

mapToJSON Method

mapToJSON Method

Previous topic Next topic  

mapToJSON Method

Previous topic Next topic  

 

Return the specified map and screen data in JSON format.

 

String HostScreen.mapToJSON(String mapName);

String HostScreen.mapToJSON(int mapIndex);

String HostScreen.mapToJSON(String mapName, int rowIndex);

String HostScreen.mapToJSON(int mapIndex, int rowIndex);

 

Arguments

 

HostScreen

 Required. HostScreen object.

 

nameOrIndex

 Required. The name or index of the map.

rowIndex

 Required. If the map is for a multi-row screen specify the rowIndex (base of zero).

 

Remarks

 

This method is useful when the screen and its data are needed in JSON format. A map has to be defined in the screen definitions file.  The mapToXMLAsRowSet bool controls the schema of the generated JSON.

 

For example, if the screen map is defined as:

 

<FieldMap name="default">

<Field name="UserProfile" row="22" column="23" length="8"/>

<Field name="Password" row="22" column="53" length="8"/>

</FieldMap>

 

If the screen's text at row 22, column 23 is "Simmy", the mapToJSON method would return:

 

If mapToXMLAsRowSet = false:

 

{"UserProfile":"Simmy","Password":""}

 

If mapToXMLAsRowSet = true (carriage returns added for readability):

 

 {"Row":"ColCount":2,"Columns":[

         {"Name":"UserProfile","WriteKey":"L_22_23_8","Value":"Simmy"},

         {"Name":"Password","WriteKey":"L_22_53_8","Value":""}

 ]}

 

Note that with the RowSet TRUE, a WriteKey is returned for write-capable fields.  See mapToXml for more information on the writeKey attribute.

 

Requirements

 

Flynet Viewer

 

See Also

 

screenToXML

 

Applies To: HostScreen object

 


© 2016 Inventu Corporation, Flynet LTD