I'm looking to conditionally create a heading for portions of a table in a Survey123 report template. I've tried a million different things, but I'm stuck on the conditional, and if it is even possible. I have attached my template in its current form, as well as an example of what I'd like to be generating with the report template. Please give any help you can! And if it's not possible, then so be it.
Basically, all I need to do is have a heading created if any records of that heading's type exist in the data (in this case, animal type, i.e. bird, mammal, amphibian, etc.). On the other hand, I also need to NOT create the heading if there are no records of that heading's type. Then, it will iterate through the species in each type below said headings to create an organized list. It already does the species iterating correctly by animal type, I just need to figure out the headings!
Happy to explain anything, but the template and example should be pretty self-explanatory. Thank you all for your help!
Option 1) Move your condition logic to the form. Save a flag to the record that you reference on the template side to determine if your header is shown.
Option 2) Write a python script to do your own document creation. Slightly more nerdy to do initially but it's way nicer to work with once you have done it once.
Ah man, so what I'm trying to do is most likely not possible? As for option 1, that's not possible with the way our data is gathered and organized. Option 2 has crossed my mind about fifteen hundred times throughout this process, as I code in Python all the time and know how easy it would be...but then it wouldn't be a report template that could be easily used.
I already have a bunch of forms where I'm providing my own UI for accessing and exporting the data after the field work so adding one more export to my flask API is pretty trivial, but the first one is without a doubt some extra work that needs to be done to go from having a script to having something easy for anyone to use.
A hybrid option where a script adds the needed flags to the record before the user gets to it and runs it through the report template document engine could potentially be a option but that seems like more work for a worse solution to me.
This is so close to possible I think it may be possible, I mostly hate the debugging of report template so much that if it's going to be hard my first thought is to find a way to move the difficult part someplace else and let it be very easy. I'd love for somebody to come along with a clever solution but I just took a quick look through the docs and I still don't have one.
Yeah, I'm feeling that too. I am heading towards a in-house UI service for reports, mapping, and other deliverables for the rest of the users in any case, so perhaps this will be part of the project. It just really is so darn close to possible that it SHOULD be possible. Perhaps I'll submit a request to ESRI, as this seems like something that may happen pretty regularly in desired outputs for reports. Either way, I have made some strides and am significantly closer to reaching the end goal here. Take a look at my current template files and the output, attached to this message, and see if they don't tickle something in your brain. Any input would be welcome!
Edit: Ignore my stupid "resultRecordCount:2-5", I know that's dumb, I was just exploring exactly what resultRecordCount does.
To delete a row in a table, you need to have tags cross at least two columns. E.g.,
You can remove the cell borders, play with font size, and make it look cleaner. E.g., My template would look more like this (the code within curly braces doesn't print, so this will just look like a normal heading in the final product):
You should avoid spaces between tags. It will add random spaces into the final product. E.g., Remove these two spaces
I don't think your data allows for this, but IF can be used on its own, and it checks for null. E.g., This line will test if ${my_field} contains a value, and if it does, display some text as well as ${my_field}: ${if my_field}Example text: ${my_field}${/}