Rutger van Dijk
Posts: 0
Joined: Tue Aug 21, 2012 9:04 am

How to merge two fields from Rest service response

While creating data mapping between response of Rest service call and elements on the page, I would like to know if it is possible to do the following:

Can I easily map fields [Name] and [Percentage] to a text label in the following format:

"[Name] ([Percentage])"

Image

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to merge two fields from Rest service response

If you map Name and Percentage to the same page components, you will get both of them passed, just not together. It will be in the same execution, but first Percentage and then Name will be passed:

Percentage
Name

One option is to save Name into local storage.

Another option is to mapped them to different page components

Percentage -- percentageComponent
Name -- nameComponent

For nameComponent, you could add this JavaScript to get the value for percentage:
code
var p = Tiggzi('percentegeComponentName').text();
/code

Now you have both values.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to merge two fields from Rest service response

I have the same question.

I have FirstName and LastName as two fields. I want the two Fields displayed in only one Label "FirstName LastName". Having two separate fields make the GUI look very 1980s.

Also, I need to be able to do this on a query that return multiple records.

Any tricks?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to merge two fields from Rest service response

Hello,

You can map FirstName and LastName to the one page component.
http://docs.appery.io/documentation/u...

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to merge two fields from Rest service response

Can you point me where this is on the page you reference. I don't see anything similar to my question. Also, I would want FirstName before LastName. How would you do that ?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to merge two fields from Rest service response

There is no exact example like you need in the above link. Screen shot should help:

Image

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to merge two fields from Rest service response

This is helpful.

How would I know which variable get updated first ?

Does the local variable always get assigned first ? If not, then the results will be random.

Can you please confirm.

Thanks

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How to merge two fields from Rest service response

Hi bahar.wadia, sorry for delay. I'm not sure I understand your questions - can you explain in more details what exactly is confusing you?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to merge two fields from Rest service response

First localStorage variable will be updated.
In this situation you need to assigned localStorage variable first. Also you can map First and Second name to localstorage variables and merged localstorage values to some component.

Return to “Issues”