I am having an issue pulling through the correct Survey questions in the correct format in to my report. In my survey I have html styling in various places including field names, choice lists, calculations etc to show text in the survey in a certain manner to aid the users visually.
This may be so that certain questions calculate a note field to change the colour of the answer or formatting in bold/italic etc, examples below
- to calculate a field called ${rating}, in the calculate field I have: if${score}>6,'<b><font color="green">GOOD CONDITION</font></b>','<b><font color="red">POOR CONDITION</font></b>'} which would produce
- GOOD CONDITION or POOR CONDITION
- in a select_mulitple choice list for ${species} I have: otter as the name and <b>Otter</b> (<i>Lutra lutra</i>) as the label which would produce...
The survey reads this syntax fine and shows up as expected within the survey app, and additionally when using the feature layer in ArcGIS Pro or AGOL webmaps it appears as expected. The problem occurs when I use ${rating} in a report, it doesn't recognise the syntax and pulls through the whole text string including the html tags. Similarly when using the ${species} in a report it does the same and lists the full strings of all species including the html tags. I assume this is due to the full string including the html tags being stored as the actual attribute value in the table.
I have tried using the following in the report as a workaround for the ${rating} but it doesn't appear to work, presumably due to the mixed single and double quotes for the text colour.
- ${if rating=='<b><font color="green">GOOD CONDITION</font></b>}GOOD CONDITION${/}${if rating=='<b><font color="red">POOR CONDITION</font></b>}POOR CONDITION${/}
I am aware that for the ${species} I could use something like the below, but with a huge amount of species in that one list (and multiple other lists with similar issues) it would become very unwieldy to have to put in an IF function for each and work out some way of having a separator between each value as well
- ${if species=='otter'}Otter (Lutra lutra)${/}
The workaround I have at the moment for one of the issues is to pass the ${rating} into another hidden field which removes the html tags and just stored the text in a question called ${rating2}, then use that in the report so the plain value comes through and can be styled in there using something like the following steps
- ${rating2}...calculation field ...if(${rating}='<b><font color="green">GOOD CONDITION</font></b>,'GOOD CONDITION','POOR CONDITION')
- then in the report use...${if rating2=='GOOD CONDITION'}GOOD CONDITION${/}${if rating2=='POOR CONDITION'}POOR CONDITION${/}
Due to my survey having 25 different variants of the ${rating} field I now have 25 hidden fields unless I want one master final rating field, but then the if function in the calculation for that would have to contain a nested if function for all of those 25 fields!
Any assistance would be massively appreciated, i am fairly new to using html styling inside survey 123 connect so if there is a better or more suitable way of getting the desired output I'm all for it!
EDIT:
In addition to the above I have a separate survey where in the survey I have a species list with the common name and then the Latin name in italic so in the choices list it is written as "Field Maple <i>Acer campestre</i>" and then displays in the survey as "Field Maple Acer campestre". when using Survey 123 feature reports this pulls through the HTML and doesn't resolve it to display in italic. I am using a separate csv with well over 1000 species in a select_one question in a repeat so cant see how I would ensure that the styling is pulled through into the report in a sensible manner
@IsmaelChivite @Katie_Clark @JamesTedrick