Select to view content in your preferred language

Only display records with a value, hide Null values in a list

888
2
Jump to solution
07-20-2023 06:14 AM
dwold
by
Frequent Contributor

I'd like to only display records that have a value, in this instance, a comment while hiding Null values in a list. Is there a way to do that with advanced formatting or another solution?

 

dwold_0-1689858827348.pngdwold_1-1689858862249.png

@jcarlson 

@JohannesLindner 

@JenniferAcunto 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Alum

If the entire line of your List template is blank, it will omit the space entirely. The easiest way is to make the "Comments:" text part of the output itself.

var comments = Iif(
  IsEmpty($datapoint['Comments'],
  '',
  `Comments: ${$datapoint['Comments']}`
}

...

return {
  attributes: {
    comments
  }
}

Then put {expression/comments} on its own line in the template. Should be what you want.

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Alum

If the entire line of your List template is blank, it will omit the space entirely. The easiest way is to make the "Comments:" text part of the output itself.

var comments = Iif(
  IsEmpty($datapoint['Comments'],
  '',
  `Comments: ${$datapoint['Comments']}`
}

...

return {
  attributes: {
    comments
  }
}

Then put {expression/comments} on its own line in the template. Should be what you want.

- Josh Carlson
Kendall County GIS
dwold
by
Frequent Contributor

@jcarlson thank you!

0 Kudos