Save a data service entity as app variable

Hi!

I’m just diving more into Apps, and also came across another confusing fact. Is there any way to store an entity as an app variable, without it being seen as an object?

Seems to me that the only type accepted as an app variable is text.

image
image

Thank you!

1 Like

Hey @Irina_Butu

You can bind the entity directly to a table.

Thanks
#nK

That’s right, but I want certain entity/list of entities to be an app variable in order to be used in many locations.

1 Like

Hey @Irina_Butu

The entity which you add for an app is similar to a variable which can be utilised in many places wherever required.

Thanks
#nK

The issue here is that i dont have permission to set an app value with other type than text. If I need a certain instance of entity User, I cannot assign it because it is not seen as User, but as Object.

1 Like

@Irina_Butu ,

You can’t bind direct entity with App variable reason you will get as a object. So what you can do please write an expression and assign the filter expression to label and on change of label you can assign the value to app variable.

Thanks,
Arvind

Hmm, I don’t quite get it.

Could you please detail your explanation?

Thanks

Here is the solution for your problem,
Step1; Assign entity record to a container data context.
e.g.

Step2; declarer an app variable, lets say ‘text_out’

Step3; bring in a text box inside the container and set the vale as follows.
-Value Binding → your variable ‘text_out’
-Default value → datacontex.desired field
e.g.

Result → the variable ‘text_out’ is now set to your desired value, you can use throughout the session.

Note; hide the container if you don’t want to show on app

@Irina_Butu

OK, Let me explain in other way, Please follow below approach.

  1. Create a App Variable.
  2. Add Data service entity with Apps
  3. Write a rule to Set value , wherever you want to do
  4. Use Lookup function to retrieve fist value based on condition
  5. Add show message to test and pass App variable in message.

I have an entity called Leave Type and I have assigned the app variable value with Set value rules. Please look at below screen shot.

Result

Thanks,
Arvind