Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I've got 2 fields jaProjectID and jfProjectID and I want combinedProjectID in the 3rd column
The data (simplified) is like so:
jaProjectID jfProjectID combinedProjectID
30 - 30
31 - 31
- P40 P40 <--using Alt results in '-'. Seems like it doesn't like alphanumeric mix.
- - -
My load function:
LOAD
jaProjectID
, jfProjectID
, if(not IsNull(jfProjectID), jfProjectID, if(not isNull(jaProjectID), jaProjectID, '*')) as combinedProjectID
//Alt(jaProject, jfProjectID as combinedProjectID <-- doesn't seem to recognise non-numbers and shows as "-"
- the nested "if" statement looks messy -- so I tried this but doesn't work
LOAD
jaProjectID
, jfProjectID
, If (IsNULL(jaProjectID) and IsNull(jfProjectID)) then
<show *>
else <....>
Question: is there another way (eg. case statements, switch or something) to replace this mess: if(not IsNull(jfProjectID), jfProjectID, if(not isNull(jaProjectID), jaProjectID, '*'))?
If one of the two fields jaProjectID and jfProjectID is always null you can simply concatenate the two fields:
LOAD
jaProjectID,
jfProjectID ,
jaProjectID & jfProjectID as combinedProjectID
From ...
Thanks, Gysbert, I appreciate it. That would be really useful in part of my real code .
For this situation, I think it looks like I'm stuck with a messy nested if statement. I was hoping there was something similar to the CASE statement in SQL. Because sometimes they are both null and then I want it to show '*'.
Try Alt function.