WORKAROUND! Query custom display settings {attribute} value

If you think that something doesn't work in Aware IM post your message here
Post Reply
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

WORKAROUND! Query custom display settings {attribute} value

Post by Rennur »

v8.0
If the value for the {attribute} in a custom display is null, the query renders the word undefined on the browser, instead of simply leaving it blank.
Attachments
undefined.png
undefined.png (27.65 KiB) Viewed 11374 times
Last edited by Rennur on Wed Sep 27, 2017 12:45 am, edited 2 times in total.
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: v8 Query custom display settings {attribute} value

Post by aware_support »

Yes, this is an inconvenience that is, unfortunately difficult to fix. Use the following workaround.

If, for example, you are displaying an attribute called Name in a custom query:
<div>{Name}</div>

use the following instead:
# if (data["Name"]) { #
<div>{Name}</div>
# }
Aware IM Support Team
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Re: v8 Query custom display settings {attribute} value

Post by Rennur »

Code: Select all

# if (data["Docket_Comments"]){#<span class="text-primary">{Docket_Comments}</span>#}
Thank you but the code didn't work for me. Invalid template error.
I've tried placing the code in the scripts section as well.
udfnerror.png
udfnerror.png (19.01 KiB) Viewed 11350 times
udfnerror2.png
udfnerror2.png (27.14 KiB) Viewed 11350 times
Same result on the browser.
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: v8 Query custom display settings {attribute} value

Post by aware_support »

Carriage returns and spaces before/after # are important. It has to be:

# if (data["Docket_Comments"]){ #
<span class="text-primary">{Docket_Comments}</span>
# }

not
# if (data["Docket_Comments"]){#<span class="text-primary">{Docket_Comments}</span>#}
Aware IM Support Team
Rennur
Posts: 1191
Joined: Thu Mar 01, 2012 5:13 am
Location: Sydney, Australia

Re: v8 Query custom display settings {attribute} value

Post by Rennur »

Thanks, adjusted. No luck.
udfnerror4.png
udfnerror4.png (13.26 KiB) Viewed 11344 times
Result is everything within the body template has been hidden. Only the header is visible and the template body border.
Invalid template error.

udfnerror3.png
udfnerror3.png (11.86 KiB) Viewed 11344 times
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: v8 Query custom display settings {attribute} value

Post by aware_support »

Sorry, my bad, forgot the closing # at the end of the last line:

# if (data["Docket_Comments"]){ #
<span class="text-primary">{Docket_Comments}</span>
# } #
Aware IM Support Team
Post Reply