XToolset icon indicating copy to clipboard operation
XToolset copied to clipboard

[Draft] Consider to add If ... else statement support.

Open jacekkoziol opened this issue 4 years ago • 1 comments

The If ... else statement would be a good solution in cases if the data model has for example an empty array, then it would be possible to display an information like 'No records...' or just omit the part of the template where there is a styled table generated by loop.

jacekkoziol avatar Feb 03 '21 12:02 jacekkoziol

I think, this issue will assumse to add:

  • IfCell, that matches #! IF [boolean]
  • ElseIfCell, that matches into #! ELSE_IF [boolean]
  • ElseCell, that matches into #! ELSE
  • EndIfCell, that matches into #! END_IF;

Questions to resolve first (until it is a draft):

  • Will we handle if statements similar to the for-each (putting them on the end of the row)? - In that way, whole rows will be omitted if the condition doesn't pass
  • Or want we use it in one line? (and how should it handle styles of omitted cells) - I rather won't do this in that way.
  • Should we have something like "if filter" (I haven't a better name for that)? (for instance ## person.lastname ?? person.isLastnameHidden) - IMO, it is an interesting idea
  • Will we allow nested if statements? IMO, we should 😄

Siemienik avatar Mar 04 '21 20:03 Siemienik