33
Views
5
Comments
How to select an id from a list of ids
Question
Application Type
Reactive
Service Studio Version
11.54.26 (Build 62807)

Filtering an entity into a list using a list of ids I have. Have the list of ids but idk how to filter it plz help. I got problem cause only option in list is .current I want to filter whole list of ids not only current !!!!! SO yeah any help appreciated



Hi Mohamed Shaafi ,

Filtering an entity into a list using a list of ids 

here we need to use this type of filter syntax

Index("#" + ID + "#","#"+GRIN_Track.Id+"#" ) <> -1

here we need to join all id using String join function first 


Kind Regards,

Ayushi Sahu

Hello,
If possible could you please share your oml.

Thanks!

Champion

Hi Mohamed,

I suggest you using an advanced SQL for this. It's the cleanest way and you avoid building complex logic with cycles.

What you basically want is to filter a specific entity GRIN_TRACK (aggregate) by a list of Ids, so you can simply convert your aggregate to an sql query and add an WHERE clause using an IN operator, like this:


SELECT GRIN_TRACK.* FROM GRIN_TRACK

WHERE GRIN_TRACK.Id IN (@ListOfIds)


You need to pass your ListOfIds to the SQL query as input parameter, and to properly do that, you can use the BuildSafe_InClauseIntegerList() action, as described here: https://success.outsystems.com/documentation/best_practices/development/building_dynamic_sql_statements_the_right_way/


Let me know if this helped,

Paulo

Champion

Hello

You can use the Index function to filter the data based on the selected Id's 

I am attaching one example for you that would help you

It is a cascading dropdown where we select multiple values from parent and basis on the selection we filter the data into child.
Sample - https://personal-ejuytnht.outsystemscloud.com/DropdownTagSample/DropdownTagSample

Attached Link you can download and check the sample - 

Sample Download Here

Thanks
Tousif Khan

Hi @Mohamed Shaafi 

If you want filter particular id your list you can use for each instead of filter for that like foreach for particular list and put if condition check whether your condition satisfy. Then you can approach for the next step you want to do.

Here i am checking the list of text in if condition for the condition i am applying in your case you can apply your condition and if it is false it goes to next iteration until last record in list.  Here i am increasing the count if it satisfy the condition.

Regards,

Kiran

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.