Joined: 22 Jun 2018
Location: India
Online Status: Offline
Posts: 2
Topic: Need code for avoid null values Posted: 24 Jun 2018 at 11:26pm
Hi Experts,
I am working on CR2016 designer.
I have one optional prompt on Comments field, but my requirement is, if user don't enter any value in prompt it should bring all values, other wise he has to bring only which are not null values in comments field along with remaining report fields.
I am trying to write below code
(not HasValue({?Comments}) = {Command.ZCOMMENTS})
or
(HasValue({?Comments}) = (not HasValue {Command.ZCOMMENTS})
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Posted: 25 Jun 2018 at 4:32am
I am assuming that this formula is in the select expert. So if you want to select all the records if a user does not enter a prompt then it normally (for me) looks something like this.
if hasValue({?Comments}) then {?Comments} = {Command.ZCOMMENTS}
the hasValue function is a boolean value, so it returns a true or false. Thus since you only want to filter when a value is entered, you would put the condition in when hasValue is true.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 25 Jun 2018 at 4:35am
why not make the prompt a Yes/No drop down
({?Comments}='No'
or
({?Comments}='Yes' and NOT(ISNULL({Command.ZCOMMENTS})))
If you want to keep what you have I am not sure what they are putting into the ?Comments option but try this
(
not (HasValue({?Comments}))
or
(HasValue({?Comments}) and NOT (ISNULL({Command.ZCOMMENTS})))
)
Joined: 22 Jun 2018
Location: India
Online Status: Offline
Posts: 2
Posted: 26 Jun 2018 at 7:59pm
Hello,
Thank you so much for your Help.
I am able to pull all values in ZCOMMENTS field data if "comments" parameter is null by Making Optional parameter. But I want If I keep any value in "comments" parameter then I want all not null values in ZCOMMENTS.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum