DTL Compile Error In Management Portal Not in Studio
I have a requirement which comes down to evaluating two fields, if they are both empty then provide a default value.
If one is empty but the other has a value, then set the empty one to the field with a value.
The screenshots are not the actual fields, I was just using the dtl and fields to prove out the solution.
When I saved and compiled in the Management Portal I got an error, but it still compiled.
I then went to studio and opened the dtl, using view-->other code then compiled and did not get the error.
Wondering if this is a true error or just an anomaly?
The code does at least through the testing tool, perform as desired.
Thanks,
Hi Ed, it appears to be the
'>1
expression. Try using=0
instead, or perhaps<1
.Syntactically the
'>1
logical construct is valid, but to me seems unconventional when there's a single logical operator that performs the exact same function.Thanks Jeff,
I did try using <1 but will try =0.
I was able to get around the error by placing the " ' " not outside the statement.
'(..Length(source.LABRSLTNUMRSLTVAL)>1)&&'(..Length(source.TSTRLTVAL)>1)
Thanks,
Ed
So, on re-reading your question and looking at your example, I'm wondering whether you really wish to check whether the fields are empty, or that they contain more than 1 character? A single character value isn't "empty" and your expression will return true if either field has zero or 1 character in it.
If you're simply checking for a condition where both fields are empty, this is a solution:
Or this, which is a bit closer to what you had come up with:
A non-zero numeric return value evaluates to true, so no need to provide a comparison operator for the individual length checks.
You are correct sir. I am checking if both field are empty.