Question: I am working with a Workshop application that includes a filter list output, which generates a single-string project ID. A TypeScript function processes this output by filtering and calculating a sum based on the selected project ID.
Problem: AIP suggests creating a variable via a string/variable transformation using an Object property that holds the filter output. However, the issue is that we can only select an Object type instead of directly accessing the single-string project ID.
Questions:
Can we use the selected project ID as a string, rather than an Object type, within the variable transformation?
Or can we create variable from the filter list output via a string [string array]
Can we pass this extracted variable into a TypeScript function as shown here:
const var = “the output of the filter list”;
.filter(fpo => fpo.projectId.exactMatch(var))
The normal pattern here would be to apply the filter variable to a new object set variable, starting from the same input object set that populates the filter widget.
You can then use a String variable - either a Property or Variable Transform with an object property reference - to access the Project ID property from the single-object object set.
You could then pass this string variable into a Function and do some further processing.
Alternatively you could pass the object set with the filter applied (rather than the object set filter) as an ObjectSet parameter into the Function to avoid the two-step of grabbing the primary key into the string variable, then using the primary key to retrieve the object in the function.
As a caveat, you’ll want to make sure your filter list is configured such that the user can end up only selecting a single object - or add a bit more to the workflow (and object selector widget; an object table or object list; etc. that can enforce a single selection).