All records in the output Bag are a json array with only values-proficient in android, IOS App application development, and jsonandroid
Closed json format content
No
Initialize records in the Bag
Same as Yibo (see the complete code section below)
Adds the name values of all records in the Bag into a string.
<for bags=item end="@{item:getLength}"> <if x="@{item:getSuffix}" else=1> <bag id=pPage x=0><we name=name>"@{item:name}"</we></bag> <bag id=pPage><we name=name>@{pPage:name},"@{item:name}"</we></bag> </if></for>
Only the array of the output value can be directly added to the output string.
Output
[@{pPage:name}]
Result
["Potato", "T-shirt", "Cola", "book"]
Complete code
<Chtml> <! -- Data preparation, you can query from the database --> <bag id = item suffix = 0> <we name = name> Tudou </we> <we name = price> 1.24 </we> <we name = unit> KG </we> </bag> <bag id = item suffix = 1> <we name = name> T-shirt </we> <we name = price> 68 </we> <we name = unit> pieces </we> </bag> <bag id = item suffix = 2> <we name = name> cola </we> <we name = price> 2.20 </we> <we name = unit> bottle </we> </bag> <bag id = item suffix = 3> <we name = name> book </we> <we name = price> 51.24 </we> <we name = unit> book </we> </Bag> </chtml> <! -- Content in json format. Only the array of output values is output in string format. --> <for bags = item end = "@ {item: getLength} "> <if x =" @ {item: getSuffix} "else = 1> <bag id = pPage x = 0> <we name = name>" @ {item: name} "</we> </bag> <bag id = pPage> <we name = name >@{ pPage: name}," @ {item: name} "</we> </bag> </if> </for> </chtml> [@ {pPage: name}]
The example file _ samples/app/array_only_value.json is in the _ samples/app/directory of the Light-open platform.
Download related resources:
Mobile App server development from entry to entry: http://download.csdn.net/detail/tx18/8741611
Building mobile App server: http://download.csdn.net/detail/tx18/8737507 quickly
Light Open Platform will occasionally upgrade to provide you with more powerful and Easy functions, please pay attention to download the latest version: http://download.csdn.net/user/tx18