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
Docgen conditions inside tables #414
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not support expr(company.supportsX="TRUE")? The back end would be able to know the context from the root of expression, company.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments.
| @@ -245,6 +245,32 @@ Default extension is vertical. If cell-extension construct is not provided, then | |||
|
|
|||
|  | |||
|
|
|||
| ### Add index based conditions | |||
| Conditionals can also be added inside tables. Condition evaluation is similar to that outside table, but we provide an additional construct | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional Sections are now supported inside Table and List. Use of 'expr-context' construct is mandatory to define conditionals inside tables and lists. 'expr-context'
Below is the example showing the usage of 'expr-context' and conditionals inside tables and lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of expr-context is not mandatory for conditions inside tables as one can also use normal conditions based on fields present outside the array of objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I raised a comment on this before, but do we need to use the expr-context expression? I don't understand why that is necessary when inside a table, I can already refer to a value that's in the array. So why do we need to provide additional context for a condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dheeraj3reddy Can you add in your thought here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider the expression expr(company.supportsX=”TRUE”). This is a condition which needs to be evaluated separately for each company i.e., each row in the final output has a different output based on its supportsX field. As per jsonata, the expression company.supportsX=”TRUE” cannot be evaluated directly as left-hand side of equation is an array of objects [“TRUE”,”FALSE”,”TRUE”] and right-hand side is a normal string. This is different from normal text tags being used inside table (like company.name as in those we don’t need any comparison as such, we just get an array result from jsonata [“ABC”,”DEF”,”XYZ”] and populate the table based on that. The key reason for conditions requiring extra context is that jsonata does not support comparison (operators like =, !=, >, <, …) between an array of objects and normal string.
Knowing context from the expression can become complicated. For that we need to parse the expressions using jsonata library. This might look simple in this case, but since jsonata supports complicated expressions also, parsing the expression to know context becomes difficult in such cases. |
…i-documentation into Docgen_conditions_in_tables
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: