549
Views
4
Comments
Solved
Index function to filter aggregate
Application Type
Reactive

Hi

In the attached file, I have 2 dropdow tags( Artists and Albums)  and the second one should be filltered based on the Id of selected artists in the first dropdown and give me the list of albums of all selected artists

It works but with a small issue

If the Artist Id =26

It give me Albums with ArtistId= 2,6 and 26

Thanks in advance

DropdownTags_Tahani.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Tahani Alabri ,

you are now looking for id's in your database that can be found in your string, so id 1 can be found if 13 is a value in your string.  

The trick is, to make sure each value in your string gets preceded and followed by a separation character (for example your ',') and then not look for id's themselves to be found in the string, but an id preceded and followed by that same separation character.

so :

in your ArtistTagsOnChanged, start the string of with a ',' and also add a final ',' afterwards. 

in your aggregate, change your condition


Dorine


2020-11-25 10-45-32
Mostafa Othman
Champion
Solution

Hello Tahani,

Kindly find attached oml which I updated way that you assign values to ArtistId variables and added "," to the beginning and the end of ArtistId value also I did same into filter of your aggregate to make sure in case Id you selected is consists of 2 digits it will match only with Id of table with same value not with one digit Id 

As you explained Id 26 return data for Id 2 and 6 because Index("26","2") will return 0 and Index("26",6) will return 1. 

Please note that Index() function we are using for text values not integer values.

DropdownTags_Updated.oml
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Tahani Alabri ,

you are now looking for id's in your database that can be found in your string, so id 1 can be found if 13 is a value in your string.  

The trick is, to make sure each value in your string gets preceded and followed by a separation character (for example your ',') and then not look for id's themselves to be found in the string, but an id preceded and followed by that same separation character.

so :

in your ArtistTagsOnChanged, start the string of with a ',' and also add a final ',' afterwards. 

in your aggregate, change your condition


Dorine


UserImage.jpg
Tahani Alabri

@Mostafa Othman 

@Dorine Boudry 

Thank you so much

2020-11-25 10-45-32
Mostafa Othman
Champion

Most welcome and good luck

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