Hi
I have a requirement where when user leaves a text box prompt empty or mistakenly enters spaces, a column in the result list should be hidden. To achieve this, I created the below conditional variable:
(trim(ParamValue('AcctName')) is null)
I need to use trim because the condition should succeed even when the user puts a space in the text box prompt. when I add the trim function the report is throwing a 'Invalid expression' error.
Any ideas or workarounds?
Thanks
VJ
Hi VJ - I might be barking up the wrong tree, but I think you need to change "...is null" to be "...is missing". Of course it depends on what platform you're using etc.
When you are dealing with variables you are dealing with report expressions, not database expressions.
Take a look at what the syntax information is for trim in the report expression dialog.
Quote
trim ( trim_what_expression , match_character_expression , string_expression )
Returns "string_expression" trimmed of any leading and trailing blanks or trimmed of the character specified by "match_character_expression". "Trim_what_expression" may be "leading", "trailing", or "both" (default). "Match_character_expression" can be an empty string to trim blanks or can specify a character to be trimmed.
Personally I'd use a Boolean render variable for the job so that the column only renders when a value is provided. I'd also use character length to avoid the whole issue with "null" vs '' for empty string vs "is missing". But then that's just a preference. There are lots of ways to tackle that logic.
character_length ( trim( 'both', '', ParamValue('AcctName') ) ) > 0
Thanks Lynn! Appreciate it..
I should have looked at the information window for 'Tips' in the first place.
Quote from: vvasireddy9 on 15 Oct 2014 01:32:25 PM
Thanks Lynn! Appreciate it..
I should have looked at the information window for 'Tips' in the first place.
I only know because I made the same mistake in the past! Very easy to overlook.