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

Create variables from element values or names. #282

Open
TobiasNx opened this issue Jan 18, 2023 · 5 comments
Open

Create variables from element values or names. #282

TobiasNx opened this issue Jan 18, 2023 · 5 comments

Comments

@TobiasNx
Copy link
Collaborator

TobiasNx commented Jan 18, 2023

At the moment you can only create variables from explicitly assigning values to variable names by put_var or put_vars.

I suggest a to_var function:

to_var("sourceElement","variableName",variableValue:"key/value")

Perhaps the feature for element names is not needed.

@blackwinter
Copy link
Member

blackwinter commented Jan 18, 2023

variableValue:"key/value"

I don't understand this part. What would it do?

Perhaps the feature for element names is not needed.

And this isn't clear to me, either. What is the "feature for element names"?

@TobiasNx
Copy link
Collaborator Author

variableValue:"key/value"

I don't understand this part. What would it do?

element:

"a" : "b"

  1. value:
    to_var("a","variableName",variableValue:"value")

Variable: $[variableName]="b"

  1. key:
    to_var("a","variableName",variableValue:"key")

Variable: $[variableName]="a"

Perhaps the feature for element names is not needed.

And this isn't clear to me, either. What is the "feature for element names"?

I was referring to 2 and therefore questioned if we need the option variableValue: at all.

@blackwinter
Copy link
Member

I see, thanks for the clarification.

I was referring to 2 and therefore questioned if we need the option variableValue: at all.

As this would be equivalent to put_var('variableName', 'a'), I don't think we should pursue it.

@blackwinter
Copy link
Member

But we need to specify how to_var() should behave if the path (sourceElement) matches a non-string.

@blackwinter
Copy link
Member

blackwinter commented Jan 18, 2023

We've previously discussed a similar issue in oersi/oersi-etl#221. The proposed "field value interpolation" would also be able to satisfy the use case here, thus obviating the need for a new function.

lookup("Sublibrary-ISIL", "$<HO-ISIL>.tsv", "sep_char": "\t", delete: "true")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants