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

IF Condition with AND and OR #277

Open
venkat352 opened this issue Jun 2, 2023 · 1 comment
Open

IF Condition with AND and OR #277

venkat352 opened this issue Jun 2, 2023 · 1 comment

Comments

@venkat352
Copy link

Hi,

How can I implement the AND or OR within my transformation? Below is the code I am trying to achieve.

"#ifgroup(#ifcondition(#currentvalueatpath($.Type),Sales,True,False)) #or #ifgroup(#ifcondition(#currentvalueatpath($.Type),Purchase,True,False))": {
"Property": [
{
--Transformation code
}
]

"#ifgroup(#ifcondition(#currentvalueatpath($.Type),Sales,True,False)) #and #ifgroup(#ifcondition(#currentvalueatpath($.Type),Purchase,True,False))": {
"Property": [
{
--Transformation code
}
]

@Courela
Copy link
Contributor

Courela commented Jun 2, 2023

As I understand you want to include or not some object, thus the use of #ifgroup, correct?
For simulating AND/OR operators, you could use nested #ifcondition.
For OR:

...
"#ifgroup(#ifcondition(#currentvalueatpath($.Type),Sales,True,#ifcondition(#currentvalueatpath($.Type),Purchase,True,False))": {
  "Property": [{
    --Transformation code
  }]

For AND

...
"#ifgroup(#ifcondition(#currentvalueatpath($.Type),Sales,#ifcondition(#currentvalueatpath($.Type),Purchase,True,False),False)": {
  "Property": [{
    --Transformation code
  }]

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