Syntax for passing filter values to Business Entities

Posted by asthomas on 06-Feb-2013 15:08

Can anyone explain how to use the input parameters for the Read method of a generated Business Entity? I am trying to set up a small test with a master detail mobile app using a locally stored variable for the key to pass to call to the BE to use as afilter to get the record details.

It is a question of simple mapping in the AppDesigner, or is js coding required?

TIA

Thomas

All Replies

Posted by maura on 06-Feb-2013 15:40

Hi, It's not necessary to do any javascript programming. You can map your locally stored variable to the filter Request parameter on the Read service.

Maura

Posted by Peter Judge on 06-Feb-2013 15:48

asthomas wrote:

Can anyone explain how to use the input parameters for the Read method of a generated Business Entity? I am trying to set up a small test with a master detail mobile app using a locally stored variable for the key to pass to call to the BE to use as afilter to get the record details.

It is a question of simple mapping in the AppDesigner, or is js coding required?

Depends/both.

You can map via the UI using drag & drop. In the screenshot below I've used a localStorage variable for the input to a read service. You can use a UI component too and use that to pass the screen value to the service call.

psdn_dnd.png

You can also code your own Javascript. Click on the "Edit JS" button, and return the value you want to have passed in to the service. My example below passes a formatted datetime. Note that there's no line into the EnteredDate field (even though there are others).

psdn_js.png

The other nice thing is that this same appoach works for responses too. There's some really nice things you can do with sets of data (mulitple rows) and list views or selects (aka drop-downs).

HTH,

-- peter

Posted by asthomas on 06-Feb-2013 15:56

Excellent. Thanks Peter - I will see if I can get this to work.

Regards / Med Venlig Hilsen 

Thomas Hansen

Director

Posted by Peter Judge on 06-Feb-2013 16:10

Last note: you can also combine both approaches, and use Javascript with a value from the screen or variable:

psdn_both.png

This lets you take a value from the screen and from (say) local storage or another UI component and transform it before it gets passed to the service.

-- peter

This thread is closed