Extracting Specific Value from Data Service

Hello Community! It’s me again

Does anyone have any idea on how I can get a specific value from a record in Data Service without having to use a table control?
Let me provide you with some context… I have a data service entity that only stores a single record and the fields are used as some kind of reference for different scenarios, for example, one field stores the number of clients, that number is then used when I create a new client, so I collect the number and then sum 1 to the number so the data is always updated.
I have provided a solution on my own using functions like lookup and with the Data Context feature, but what if I want to get these values from an Event, How do I reference the value and set it to a variable of some kind?

I am wondering if someone has any better logic to achieve it.

@Luis_Fernando ,

Did u try lookup function to set individual value?

Thanks,
Ak

Hello @Arvind_Kumar1
Could you provide an example?

Thank you

Hello @Luis_Fernando ,

Try something as below, I have written a function to get Leave description based on type.

image

Here is result.

image

Thanks,
Arvind

That looks great
Hope you don’t mind answering these questions just to break down a bit.

Is LeaveType.Description a field of the Entity?
How is the “.LeaveType.Description” acting in the function? Cause if you would have left the expression as " LookUp(LeaveType,[LeaveType.Type, “=”, “Sick” ]) "
in that case, the output would have been the whole record object. So I guess that adding the “.LeaveType.Description” you are now able to also get the specific value from the field of the selected record. I’m getting it right? I just didn´t know you could add that extra step, and in the documentation, I guess I didn’t notice it. I’m still a beginner in expressions logic.

Thank you very much @Arvind_Kumar1

@Luis_Fernando ,

Yes you are correct if you put function().filed name then this will return single column value.

Thanks,
AK

@Arvind_Kumar1
Thanks Arvind always being very helpful.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.