Selector Issue with Getting Substring from a String

394
4
08-09-2023 12:02 PM
CGooch
by
New Contributor II

So I am dealing with a Parks dataset that has multiple records and each park has an individual field for each amenity such as "Restrooms", "Swimming", or "Hiking" with either a "yes" or "no" to indicate if the park has that specific amenity. I also have an "Amenities" field that has all the amenities as a string. For Example, "Central Park" has an "Amenities" value of 'Restrooms, Swimming, Hiking, Baseball, Basketball, Cycling'. 

I am trying to use a selector to assign each amenity to a category so that if I click on the "Restrooms" category, each park that has restrooms as one of its amenities will be selected. My biggest issue is that when I try to configure the selector to categorize "Amenities" it displays the entire string rather than each individual substring.

Does anybody know how I can use a data expression to fix this?

0 Kudos
4 Replies
EH_Alaska
Occasional Contributor

Hey @CGooch!

I'm not super familiar with data expressions, but after doing a bit of research on them I was able to find this example code for separating out comma-delimited values. 

0 Kudos
CGooch
by
New Contributor II

I've tried using this example and it works in the sense that it shows the counts of each amenity, but my problem is that I need to be able to select ALL parks that contain the amenity in the selector category. For example, one of the parks only has 'Hiking' as an amenity so when I click on Hiking in the selector that park is selected but not the other parks that also contain Hiking.

0 Kudos
CGooch
by
New Contributor II

I've also tried to use If statements like in the attachment that would reference each individual amenity field rather than the concatenated "Amenities" field, but it only returns one amenity.

code.jpg

0 Kudos
ChipMorgan65
Occasional Contributor

Hi,

   I've got a similar issue and have not found a solution in Dashboard...though I have found a solution in Experience Builder.

   The best that I've been able to do is to configure the selector to support multiple selections, have a search option, and allow select all, reset. It's damned kludgey compared to how effectively it can be done in ExB. 

Chip

0 Kudos