Hi, David
I meet some issue after update from 2016.95
2016.95 (03/31/2016)
* Fix a bug in the ObjectGetProp action which causes we can't get the expected object's property value if we try to use a variable for the object's property name. Thanks Terje!
This is my code from login view.Before I update it can get data.I use HttpClient Post method to get data array from mysql via php in json format.It response normally.
loginclient.Response = Httpclient can get data from json
ObjectGetProp cannot get my data out from array after I update to 2016.95
Do I miss something?
Here,in console I rollback to 2016.94 and capture
v. 2016.94
v. 2016.95 update at 04/01/2016 (It 2016.96 in description but in program still 2016.95)
in older version can get data.
I rollback for now.
I investigating...found error at sample json2
because json2 sample is the same code with my code
It cannot get value too
in console error
--------------------------------------------------------------------------------
App Builder saved debugger console
App name: JSON2
Generated: 4/1/2016 2:10:41 PM
--------------------------------------------------------------------------------
Legend:
[a] App action
[n] Net request
Information message
[w] Warning message
[e] Error message
Unknow message
[+] Block start
[-] Block end
--------------------------------------------------------------------------------
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\index.html"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\builder\styles\default.css"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\builder\styles\builder.css"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\app\styles\scaled.css"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\app\scripts\app.js"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\builder\scripts\builder.js"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\cordova.js"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\builder\fonts\digital-7-mono.ttf"
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\app\views\NewView1.html"
[+] Start of Button1 Click event
[a] 000001 HttpExecute "HttpClient"
[-] End of Button1 Click event
[n] Resolved "D:\Users\Administrator\Documents\AppBuilder\Samples\JSON2\JSON2_Compiled\www\app\files\data.json"
[+] Start of HttpClient Success event
[a] 000001 SetVar "[Textarea.Value]" "" "String"
[a] 000002 ArrayLength "[HttpClient.Response]" "[TotalRecords]"
[a] 000003 Dec "[TotalRecords]"
[a] 000004 Loop "0" "[TotalRecords]" ""
[a] 000005 SetVar "[SportsLog]" "" "String"
[a] 000006 ArrayGetItem "[HttpClient.Response]" "" "[Item]"
[a] 000007 ObjectGetProp "[Item]" "ID" "[ID]"
[a] 000008 ObjectGetProp "[Item]" "Name" "[Name]"
[a] 000009 ObjectGetProp "[Item]" "Sports" "[Sports]"
[a] 000010 ArrayLength "[Sports]" "[TotalSports]"
[e] Error: "Unable to get property 'length' of undefined or null reference" - Line: 290 - Char: 13 - Code: 0 - Url: http://127.0.0.1:9999/app/scripts/app.js
--------------------------------------------------------------------------------
©2016 David Esperalta's App Builder
More information at https://www.decsoftutils.com/
--------------------------------------------------------------------------------
Hello,
First of all, sorry for the inconveniences. And thanks for your feedback and research tin. Yesterday I fix a bug in the "ObjectGetProp" action, and, now they works as expected, however, we can't write something like this code now:
This simple "confuse" the App Builder code translator. What we must to do is something like the below one:
That is, the property name must be different to the result variable. So remember the below code doesn't work:
But this other works like expected:
I want to study this deeply, but this behaviour is not only related with this specific action, then, take note tin.
I understood it thanks,David.It better to use other name that was not the same key name(it make me confuse too.But I copy your sample code from json2 sample hahaha)
Ps.You need to change code in json2 sample too.It will make newer confuse too.
thanks for quick support. David :)
Hello tin,
Thanks for your considerations. The JSON2 sample has been fixed and AB is now updated. Certainly I need to study this kind of situation, because maybe I can take another approach, which allow us to name variables like object properties, etc.
It better to be not the same name ,David.
(I don't know that can set not the same,that why I coding like that. lol
Hello,
It better to be not the same name ,David.
(I don't know that can set not the same,that why I coding like that. lol
Probably the better can be to allow us to choose: use the same name or not to use it. :)
Hello,
Probably the better can be to allow us to choose: use the same name or not to use it. :)
I made the appropiate changes in order to allow us to write code like this without problems:
Changes also affects to some other actions in the same way than the "ObjectGetProp" action.
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.