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

Closed
TobiasNx opened this issue Jan 18, 2023 · 6 comments · Fixed by #365
Closed

Create variables from element values or names. #282

TobiasNx opened this issue Jan 18, 2023 · 6 comments · Fixed by #365
Assignees

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")

@TobiasNx
Copy link
Collaborator Author

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

This should only work with string-elements, and should be overwritten if already exists.

I am not sure, but perhaps some of the code could be reused in metafacture/metafacture-core#533

@TobiasNx TobiasNx moved this to Working in Metafacture Sep 23, 2024
@TobiasNx TobiasNx assigned blackwinter and TobiasNx and unassigned blackwinter Sep 23, 2024
TobiasNx added a commit that referenced this issue Sep 23, 2024
TobiasNx added a commit that referenced this issue Sep 23, 2024
TobiasNx added a commit that referenced this issue Sep 23, 2024
TobiasNx added a commit that referenced this issue Sep 23, 2024
blackwinter added a commit that referenced this issue Sep 24, 2024
blackwinter added a commit that referenced this issue Sep 24, 2024
TobiasNx added a commit that referenced this issue Oct 14, 2024
TobiasNx added a commit that referenced this issue Oct 14, 2024
TobiasNx added a commit that referenced this issue Oct 14, 2024
Add new fix method to set variable with element value #282
@github-project-automation github-project-automation bot moved this from Review to Done in Metafacture Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants