February 12, 20196 yr I made webhook sms api integration into my solution , I am trying to extract data with formatiing with following calculation - "smsbalance" = Left ( RightWords ( GetLayoutObjectAttribute ( "SMS BALANCE"; "CONTENT"; 1 ) ; 3 ) ; 4 ) I am getting desired result but whats happening is "smsbalance" field is not getting updated till i enter into the field smsbalance click into it and clicking outside tried lot scripting entering into it commiting records refreshing windows webviewer is getting updated but not "smsbalance" as u can see i have 4 digit sms balance , how to calculated to any number of sms balance remaining ??/ hope i am clear sms balance" Edited February 12, 20196 yr by Dr.Gopala krishnam raju AMBATI
February 12, 20196 yr Why use a web viewer if the data from the API returns JSON object? Just use Insert URL to field or variable and then get the results and use the JSON functions to return the balance.
February 12, 20196 yr Author I know wats JSON no experience to how use JSON and curl never touched will try if failed will cum back saw JSON I don't know what they do plz help with example I will try to understand and apply Edited February 12, 20196 yr by Dr.Gopala krishnam raju AMBATI
February 12, 20196 yr If you can get JSON (or even better, XML) from the data provider, that's certainly preferable to scraping a web page. To get help with parsing the JSON response, show us an example and explain what you want to extract to where.
February 12, 20196 yr Re your original question: if the field is unstored, it should refresh when you do Refresh Window. You could also give it an object name and use the Refresh Object script step to refresh it explicitly.
February 12, 20196 yr Author 31 minutes ago, comment said: Re your original question: if the field is unstored, it should refresh when you do Refresh Window. You could also give it an object name and use the Refresh Object script step to refresh it explicitly. tried a lot not working trying since 1hr wat oceanwest said using insert url and json get element kept url into field mistake happening where i am not understanding ???? yes i did it but json balance is not updating DID SOMETHING WORKING PERFECT TODAY I LEARNT JSON used above calculation what does[0] mean i dont know Edited February 12, 20196 yr by Dr.Gopala krishnam raju AMBATI
February 12, 20196 yr GetAsNumber ( JSONGetElement ( $json ; "[0]BALANCE" ) ) The key is case sensitive and has to match exactly to the raw JSON and because the JSON is an ARRAY you need to declare [0] as arrays in JSON start at zero json.fmp12
February 12, 20196 yr Author 4 minutes ago, Ocean West said: GetAsNumber ( JSONGetElement ( $json ; "[0]BALANCE" ) ) The key is case sensitive and has to match exactly to the raw JSON and because the JSON is an ARRAY you need to declare [0] as arrays in JSON start at zero json.fmp12 212 kB · 0 downloads yup tx
February 12, 20196 yr it's a good habit to cast your JSON results to the type of data you want: GetAsDate () GetAsText() GetAsNumber()
February 12, 20196 yr Author 1 minute ago, Ocean West said: it's a good habit to cast your JSON results to the type of data you want: GetAsDate () GetAsText() GetAsNumber() OK GOT IT WILL REMEMBER 13 minutes ago, Ocean West said: it's a good habit to cast your JSON results to the type of data you want: GetAsDate () GetAsText() GetAsNumber() HAHAHAHA tx for the idea u gave now i am more complex now i m pulling delivery status
February 12, 20196 yr Author 17 minutes ago, Ocean West said: it's a good habit to cast your JSON results to the type of data you want: GetAsDate () GetAsText() GetAsNumber() HAHAHAHA tx for the idea u gave now i am more complex now i m pulling delivery status
February 12, 20196 yr 1 hour ago, Ocean West said: it's a good habit to cast your JSON results to the type of data you want: GetAsDate () GetAsText() GetAsNumber() It shouldn't be necessary as a rule. JSON has only 3 data types for values - string, number and boolean - and the JSONGetElement() function returns the appropriate data type for each. That should eliminate the need to use GetAsText() or GetAsNumber() on the result. As for other types such as dates, GetAsDate() will work only if the extracted string matches the date format currently used by the file - which I sincerely doubt will happen often. Edited February 12, 20196 yr by comment
February 12, 20196 yr as a rule I'd agree, however i have had a few experiences when I see numbers with quotes in JSON that means that it may interpret it as string/text vs number and if you push the value between a few variables you also risk loosing the data type cast - making simple boolean logic fail. I suspect it's more prevalent when doing an SQL call to get a value vs pulling it from JSON object as JSON interpreter in the platform is fairly modern, and somewhat intuitive.
February 12, 20196 yr 2 hours ago, Ocean West said: however i have had a few experiences when I see numbers with quotes in JSON If you see numbers with quotes in JSON it can mean only one of two possible things: They're not meant to be interpreted as numbers - e.g. phone numbers or ZIP codes; or: The JSON providers do not know what they're doing. In the latter case there may be justification to force the data type explicitly - though I would guess in most cases failing to do so will not cause any problems, since Fiiemaker will eventually do it for you implicitly. Fo example: JSONGetElement ( $json ; "text" ) * 2 returns 246, even though $json contains: { "text" : "123" } Edited February 13, 20196 yr by comment
Create an account or sign in to comment