02-16-2017 11:39 AM - edited 02-04-2024 6:36 AM
Hi, I've been trying to write a SQL script in HANA Studio for creating a calculated column using the following pseudo code logic
If ("AUGBL_ORIG" is empty) { if ("AUGBL_BSEG_Vendor" is empty) { return "AUGBL_BSEG_CUSTOMER" } else { return "AUGBL_BSEG_Vendor" } } else { return "AUGBL_ORIG" } What would would be the best way to write the logic? Should i use CASE function or IF statements
Please help!
IF function would be efficient for that. In case "empty" means null, you an also use the ISNULL function instead of the "!=" operator which compares to '' in the following example:
if("AUGBL_ORIG" != '', "AUGBL_ORIG", if("AUGBL_BSEG_Vendor" != '',"AUGBL_BSEG_Vendor","AUGBL_BSEG_CUSTOMER"))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Florian,
I'm getting an error when I'm trying to save and validate the HANA model. I'm running the script for calculated column in calculation engine.
Do you have an idea as to what is causing the error?
I have propagated the calculated column to semantics & have checked and activated the dependent HANA model.
Regards
Faheem
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.