- Posts: 371
- Thank you received: 3
Calculation / If Statement help needed
10 years 7 months ago #6188
by ckelsoe
Calculation / If Statement help needed was created by ckelsoe
I have a source field that requires a value. I also want to append the phone extension to that value if it is available. I first wrote the following expression which works sort of...
I also set the OnError = Set to Value 000-000-0000 however, the calculation fails and all that is written is the 000-000-0000.
I then tried the following which also fails
I also tried the following which also fails:
How does this need to be written so it works?
Code:
BEGIN
Iif(Length([F002])> 0,[F001] + ' ext ' + [F002],[F001]) ;
END;
I also set the OnError = Set to Value 000-000-0000 however, the calculation fails and all that is written is the 000-000-0000.
I then tried the following which also fails
Code:
BEGIN
if(Length([F001]> > 0 Then
Result : = Iif(Length([F002])> 0 THEN [F001] + ' ext ' + [F002],[F001]) ;
else
Result : = '000-000-0000'
END;
I also tried the following which also fails:
Code:
if(Length([F002])> 0 THEN
BEGIN
Result := [F001] + ' ext ' + [F002]
END
Else
BEGIN
Result := [F001]
END;
How does this need to be written so it works?
Please Log in or Create an account to join the conversation.
10 years 7 months ago #6196
by admin
Mike
ETL Architect
Replied by admin on topic Re: Calculation / If Statement help needed
It should be
BEGIN
result:=Iif(Length([F002])> 0,[F001] + ' ext ' + [F002],[F001]) ;
END;
Iif is a function
BEGIN
result:=Iif(Length([F002])> 0,[F001] + ' ext ' + [F002],[F001]) ;
END;
Iif is a function
Mike
ETL Architect
Please Log in or Create an account to join the conversation.