How would one extract values from a string

I get this returned from a payment gateway.

“PAYGATE_ID=10011072130&PAY_REQUEST_ID=EEB7B865-AD12-D31E-5357-A384A9A9E306&REFERENCE=pgtest_123456789&CHECKSUM=cf0d24ff09a154159c5cb41810e72b3e”

How would I set these values in server connect as (* taking the string above an split them into 4 values)

PAYGATE_ID=10011072130
PAY_REQUEST_ID=EEB7B865-AD12-D31E-5357-A384A9A9E306
REFERENCE=pgtest_123456789
CHECKSUM=cf0d24ff09a154159c5cb41810e72b3e

@Mozzi,

if you are going to use it in a javascript;

Dummy Example
dmx.app.data.yourpageid.serverAction.data.xxxx

You can reach the values you want with a similar method.
If you want to reach other than that in wappler, you need to create API SCHEMA while making this query, you can do this very simply thanks to wappler.

I have managed to split the string into 4

So in the API… how to do I return the value…

I have tried… {{PAYGATERETURN.[0]}}

Why don’t you use the define schema property. In this way, you can easily use the values you want.

this way life will be easier

with this API you post to it … Data type FORM…

Once you POST the values… then only it “responds” so you cant fetch the schema before you have actually posted the information… as the “initiate” only gets generated after the api is called / submitted…

if you have example response u can use it in define schema

If you have data returned as a string:

data: "some&string&goes&here"

this:

{{data.split('&')[0]}}

will return some

this:

{{data.split('&')[1]}}

will return string

etc.

1 Like

Also api providers often share an example response schema. You can get the result you want by adding the schema example here.

thanks for the help… but i came right with the solution from Teodor… as I already had the values. thank you.

Thank you for the help @Teodor.

you are welcome @Mozzi