Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can access a nested property of a variable by using a dynamic path #11293

Closed
saig0 opened this issue Dec 19, 2022 · 2 comments · Fixed by camunda/feel-scala#601 or #12103
Closed

I can access a nested property of a variable by using a dynamic path #11293

saig0 opened this issue Dec 19, 2022 · 2 comments · Fixed by camunda/feel-scala#601 or #12103
Labels
area/bpmn-support Marks an issue as related to supporting BPMN symbols component/engine kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog support Marks an issue as related to a customer support request version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0

Comments

@saig0
Copy link
Member

saig0 commented Dec 19, 2022

Is your feature request related to a problem? Please describe.
My process has the following variables:

x = {"y": {"z": 1}}

path = "y.z"

I want to access the nested property y.z of the variable x in a FEEL expression, for example, on an exclusive gateway.

Instead of using static access x.y.z, I want to use the other variable path to define the access dynamically.

Describe the solution you'd like
I can access the (nested) property of a variable by defining a variable as the path.

In FEEL, there is the function get value() that accesses a value of a context by a given key. We could extend the function to accept not only a single key but a list of keys. The list of keys is interpreted as the path.

get value(x, path)

// with `path` being a list of the keys `["y", "z"]`
get value(x, ["y", "z"])

An alternative to the list ["y", "z"] would a string "y.z". But this option is not preferred because it would require an implicit transformation of the string into a path with the parts y and z.

Describe alternatives you've considered
I access the (nested) property of a variable by using the static name x.y.z.

Additional context
Related support case: https://jira.camunda.com/browse/SUPPORT-15389

@saig0 saig0 added kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog support Marks an issue as related to a customer support request area/bpmn-support Marks an issue as related to supporting BPMN symbols labels Dec 19, 2022
@korthout
Copy link
Member

korthout commented Jan 11, 2023

I want to use the other variable path to define the access dynamically.

An alternative to the list ["y", "z"] would a string "y.z". But this option is not preferred because it would require an implicit transformation of the string into a path with the parts y and z.

Your main proposal doesn't use the path variable. Either the transformation needs to happen in the FEEL function, or the user must perform it explicitly.

IMO, the implicit path transformation is easier to use. Are there any downsides to us performing this transformation implicitly?

@saig0
Copy link
Member Author

saig0 commented Jan 19, 2023

Your main proposal doesn't use the path variable. Either the transformation needs to happen in the FEEL function, or the user must perform it explicitly.

Yes. In the example, I unwrapped the variable path. So, the solution should look like this:

get value(x, path)

With the given variables:

x        = {"y": {"z": 1}}
path   = ["y", "z"]

I updated the description. 👍

MO, the implicit path transformation is easier to use. Are there any downsides to us performing this transformation implicitly?

The option of using a list of keys is more aligned with the DMN spec. There is already an existing function context put(context, keys, value) with a similar argument keys of the type List<String>. So, the chance is high that the function will be adopted by the OMG.

The implicit conversion of y.x would be a very special case and would conflict with the existing get value() function if the key contains . in its name (which is possible in FEEL). So, the chance is lower that this solution will be adopted.

ghost pushed a commit that referenced this issue Mar 23, 2023
12103: deps: dump feel-engine from 1.15.3 to 1.16.0 r=korthout a=saig0

## Description

Dump feel-engine from 1.15.3 to [1.16.0](https://github.com/camunda/feel-scala/releases/tag/1.16.0).

## Related issues

Support-related issues:
- camunda/feel-scala#508 for [SUPPORT-14012](https://jira.camunda.com/browse/SUPPORT-14012)
- #11293 for [SUPPORT-15389](https://jira.camunda.com/browse/SUPPORT-15389)

Closes #11293



Co-authored-by: Philipp Ossler <[email protected]>
ghost pushed a commit that referenced this issue Mar 24, 2023
12103: deps: dump feel-engine from 1.15.3 to 1.16.0 r=saig0 a=saig0

## Description

Dump feel-engine from 1.15.3 to [1.16.0](https://github.com/camunda/feel-scala/releases/tag/1.16.0).

## Related issues

Support-related issues:
- camunda/feel-scala#508 for [SUPPORT-14012](https://jira.camunda.com/browse/SUPPORT-14012)
- #11293 for [SUPPORT-15389](https://jira.camunda.com/browse/SUPPORT-15389)

Closes #11293



Co-authored-by: Philipp Ossler <[email protected]>
@npepinpe npepinpe added the version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0 label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bpmn-support Marks an issue as related to supporting BPMN symbols component/engine kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog support Marks an issue as related to a customer support request version:8.2.0 Marks an issue as being completely or in parts released in 8.2.0
Projects
None yet
4 participants