I have this field derivation:
IF IsNull(Lookup_OrderLine.HOIPDNO) THEN " " ELSE FMT(Lookup_OrderLine.HOIPDNO[1,2],"2 L") : IF IsNull(Lookup_MinBX65.BX65TPUR) THEN " " ELSE FMT(Lookup_MinBX65.BX65TPUR[1,2],"2 L")
I was expecting that this would always produce a four-character string. However, if the values are null, it produces a string of two spaces. Any idea why?
I think the values are null because when I map the above and then the two input two fields to a csv sequential file, I get this:
"PK ","PK"," "
" ",,
Update: put in to stop the spaces being compressed
Nulls and padding
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 1044
- Joined: Wed Sep 29, 2004 3:30 am
- Location: Nottingham, UK
- Contact:
Nulls and padding
Last edited by PhilHibbs on Fri Feb 04, 2005 5:17 am, edited 1 time in total.
Phil Hibbs | Capgemini
Technical Consultant
Technical Consultant
-
- Premium Member
- Posts: 1044
- Joined: Wed Sep 29, 2004 3:30 am
- Location: Nottingham, UK
- Contact:
Re: Nulls and padding
Got it, I think the second IF is being treated as part of the ELSE clause. I will break it up into stage variables.
Phil Hibbs | Capgemini
Technical Consultant
Technical Consultant
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Hello Phil,
will work.
[/code]
You guessed it; the statement doesn't parse the way you wish when written that way, you can add parenthesis to make it work, along the lines ofIF IsNull(Lookup_OrderLine.HOIPDNO) THEN " " ELSE FMT(Lookup_OrderLine.HOIPDNO[1,2],"2 L") : IF IsNull(Lookup_MinBX65.BX65TPUR) THEN " " ELSE FMT(Lookup_MinBX65.BX65TPUR[1,2],"2 L")
Code: Select all
(IF Cond1 THEN 'a' ELSE 'b') : (IF Cond2 THEN 'c' ELSE 'd')
[/code]
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>