Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2109 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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 

501665250_Screenshot2019-02-12at17_02_25.thumb.png.40cdbaa6d655633ddfc0fb3159da784f.pngsms balance"

 

Edited by Dr.Gopala krishnam raju AMBATI
Posted

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.

Posted (edited)

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 by Dr.Gopala krishnam raju AMBATI
Posted

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.

Posted

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.

Posted (edited)
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

 

1654171575_Screenshot2019-02-12at23_39_37.thumb.png.110eaff4ce1f22173a0828e83cb87573.png1424136153_Screenshot2019-02-12at23_31_54.thumb.png.64c34c88468c062d735822b6c1196816.png830216042_Screenshot2019-02-12at23_33_09.thumb.png.46b1b4deca33d51fc5b902b4c2f81946.png

mistake happening where i am not understanding ????

1267799665_Screenshot2019-02-12at23_46_27.thumb.png.2c4e0e52c99fca8a0ed882d250ae5585.png

yes i did it but json balance is not updating ???

DID SOMETHING WORKING PERFECT TODAY I LEARNT JSON 

1369722303_Screenshot2019-02-12at23_56_53.thumb.png.9a208e3670ebdd7a2d4aba680cfe3a83.png

1258977277_Screenshot2019-02-12at23_59_39.thumb.png.77b127c49472a12d2a468fb3b8700288.png

used above calculation what does[0] mean i dont know ??? 

Edited by Dr.Gopala krishnam raju AMBATI
Posted

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

Posted

it's a good habit to cast your JSON results to the type of data you want:

GetAsDate ()
GetAsText()
GetAsNumber() 

 

Posted
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

1387832808_Screenshot2019-02-13at00_37_37.thumb.png.e31bd9f803559f358f400b39e861bb59.png

now i m pulling delivery status :)

Posted (edited)
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 by comment
Posted

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. 

Posted (edited)
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:

  1. They're not meant to be interpreted as numbers - e.g. phone numbers or ZIP codes;  or:
  2. 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 by comment
  • Like 1

This topic is 2109 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.