Select to view content in your preferred language

How can I use MultipleExpressionResolveResults or use more than one field in an expression in a custom Experience Builder widget?

590
1
04-26-2023 02:40 PM
JohnPhillipsGeo
Regular Contributor

Hello, 

I am trying to build a widget that will use two or more fields from a single data source. 

I've cloned the use-expression widget from Esri's Github

https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/widgets/use-expression

Here's the issue I'm running into.  When I try to use two fields in the expression, I get an Invalid Expression error:

JohnPhillipsGeo_0-1682544637274.png

If I could solve this error and use more than one field in the Expression builder, I could parse it out in the Widget.tsx file.  However, that isn't working for me so I've been trying another approach.


In the API reference, there appears to be a MultipleExpressionResolveResults object. 

https://developers.arcgis.com/experience-builder/api-reference/jimu-core/MultipleExpressionResolveRe...

This appears to be related to the ExpressionResolverComponent.

https://developers.arcgis.com/experience-builder/storybook/?path=/docs/components-jimu-core-expressi...


However, in this solution, I cannot combine the individual expressions into an IMExpressionMap to pass into the ExpressionResolverComponent.  

Any help and/or examples of using multiple expressions/fields in a widget would be much appreciated.  I can provide my code or snippets on request.  Thanks!

0 Kudos
1 Reply
DanJiang
Esri Contributor

Hi @JohnPhillipsGeo , 

For different parts of the expressions, you need to use the "+" to combine the results into one string, something like. 

DanJiang_0-1689760199625.png

 

0 Kudos