Re: Accessing an object's property by string in Xbasic?
Hi All
Can you point me to what I am doing wrong here? I have a Android App
I have a customer who has a wholesale business his customers all have differing rate. So if the customers walk around the warehouse scanning in the items they want.
When they come to submit the order if they are offline I copy there line items into a offline list and when they come back online they upload the offline list and they submit this addition data in the ajax callback getDataOffLine()
So I am looking for three parts of the data listData and I have been trying to do it like this
My problem is with the vPrice being type of P I have tried to convert it to both C & N but the system still complains the variable is of the wrong type.
I found this thread and Selwyn says we can use the .data which I have tried to do without any success
myRate = strObj.data(P[i] + ".PRICE")
This does seem a better way of doing it if I could get it to work. This what my listData looks like before I convert it
Any help you could give would be greatly appreciated
Andy
Hi All
Can you point me to what I am doing wrong here? I have a Android App
I have a customer who has a wholesale business his customers all have differing rate. So if the customers walk around the warehouse scanning in the items they want.
When they come to submit the order if they are offline I copy there line items into a offline list and when they come back online they upload the offline list and they submit this addition data in the ajax callback getDataOffLine()
Code:
function getDataOffLine() { var lobj = {dialog.object}.getControl('OffLine'); var _d = lobj._rData; var _data = JSON.stringify(_d); var returnData = A5.ajax.buildURLParam('__listData',_data) return returnData }
Code:
listData = e.__listData dim p as p dim count as n = 0 dim msg as c 'Put the list into a useable format if listData <> "" then p = json_parse(listData) 'Count the number of rows count = p.size() else Msg = "No rows" end if for i = 1 to count 'Get the product ID zSNUMBER = "p[" + i + "].SNUMBER" vSnumber = eval(zSNUMBER) args.set("PORDER_ID",vSnumber) zPRICE = "p.[" + i + "].PRICE" vPRICE = eval(zPRICE) 'yPrice = typeof(vPRICE) ' always type of P, format of Price is 0.00 ''get number of items zAMT = "p.[" + i + "].AMT" vAMT = eval(zAMT) 'xamt = typeof(vAmt) ' Always type of C, format of vAMT is always integer which I convert later on I then do some calculations to get total Price, Sales Tax, total at cost
I found this thread and Selwyn says we can use the .data which I have tried to do without any success
myRate = strObj.data(P[i] + ".PRICE")
This does seem a better way of doing it if I could get it to work. This what my listData looks like before I convert it
Code:
[{"PRODUCT_ID":"P10004935","NAME":["360 by Twist E-liquids 60ml Shortfill"],"PRICE":["6.5"],"SNUMBER":"10000712","TYPE":"","MODIFIERS":[""],"AMT":"5","Total":"32.50","*key":0,"*renderIndex":0,"*value":"P10004935"},{"PRODUCT_ID":"P10000902","NAME":["77 Flavor by Malaysian brew African Mango"],"PRICE":["5"],"SNUMBER":"10000712","TYPE":"","MODIFIERS":[""],"AMT":"6","Total":"30.00","*key":1,"*renderIndex":1,"*value":"P10000902"},{"PRODUCT_ID":"P10004936","NAME":["360 by Twist E-liquids 60ml Shortfill"],"PRICE":["7.96"],"SNUMBER":"10000712","TYPE":"","MODIFIERS":[""],"AMT":"5","Total":"39.80","*key":2,"*renderIndex":2,"*value":"P10004936"}
Andy
Comment