Decode Function in Informatica - informatica

Can anyone please help me to write a decode function in Informatica for the below case statement?
CASE WHEN Employee in ('210','220','230') and Score like '7%' THEN concat(SUBSTRING(Employee,1,2),'2')
WHEN Employee in ('210','220','230') and Score not like '7%' THEN concat(SUBSTRING(Employee,1,2),'1')
ELSE Employee END as New_Employee
Thanks!!

You can use decode to test out multiple conditions like CASE WHEN. It works exacly like case when.
DECODE( TRUE,
Employee in ('210','220','230') and substr(Score,1,1) = '7', concat(substr(Employee,1,2),'2') ,
Employee in ('210','220','230') and substr(Score,1,1) <>'7',concat(substr(Employee,1,2),'1'),
Employee )
So, it will check if first condition is true, if yes it will exit else check second, if true, it will exit and so on ...

Related

how to use a conditional statement to stop a code with several inputs?

I wrote a code and want to end it after the first input is equal to "done".
If I write the condition after all of the inputs, the user should answer all the useless questions.
On the other hand, I don't want to write the condition in the middle of the inputs as you see in the following part.
I would appreciate it if anyone could help me with this.
Here is the code:
while True:
ind1=input('please enter your personal number:')
if ind1=='done':
break
ind2=input('please enter your name:')
ind3=input('please enter your family name:')
ind4=int(input('please enter your working hours:'))
ind5=int(input('please enter your payment:'))
Instead of using multiple variables, use an array.
pseudo code:
inputs = []
count = 0
while true:
if inputs[count] == 'done': break
inputs[count] = input('...')
count++

How to give if condition for propercase and uppercase in sap crystal report

I am getting two values one is printing Cash and other is printing CASH in sap crystal report. Now, I want that wherever Cash is showing at that time value should be false while if CASH is printing then the value should show true. So, for that I added the formula but didnt work,
here is my formula,
if(ProperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
then {TmpSalesBillInstallmentReport.PaymentType}= '0'
else if(UpperCase({TmpSalesBillInstallmentReport.PaymentType}) = true)
{TmpSalesBillInstallmentReport.PaymentType} = '1'
This formula is not working, even getting error i.e. A Boolean Is Required Here(indicating on the first line)
I surfing in net but didnt get related question also.
IF {TmpSalesBillInstallmentReport.PaymentType} = "CASH" Then True ELSE False;
Note: A Crystal formula cannot assign a value to a database field. The field value is Read Only!
UpperCase() function is not a test that returns true or false. It simply returns the text argument after converting it to all upper case.
You might have a setting causing comparisons to be case insensitive.
See: http://www.plumblineconsulting.com/crystal-reports-and-case-sensitivity-of-database-records/

Informatica conditional

I am trying to add some logic to my expression table (exp_source). Basically, if the field o_field_digital__c is 'Yes' then change it to 'Y'. If its 'No' then change it to 'N' and if it's Null then just leave it blank. I put in the following and its showing syntax error
IIF(o_Field_DRC_Choice_Eligible__c = 'Yes', 'Y')
IIF(o_Field_DRC_Choice_Eligible__c = 'No', 'N')
Can you please fix this? Do I only need one IIF statement? this obviously has syntax errors
First you need to understand it is a transformation not a table.
Second, you can't change the value of an input port - you can only create a new calculated variable or output port
Last... IIF syntax is
IIF(condition, return true, return false)
As you can see you haven't provided a value for the return false argument which ironically is where you should have nested the subsequent IIF. Also you will have to specify to otherwise leave blank in the missing return part of the nested IIF.
to correct you will need to nest them so
IIF(o_Field_DRC_Choice_Eligible__c = 'Yes', 'Y', IIF(o_Field_DRC_Choice_Eligible__c = 'No', 'N', ''))
You can use the below logic for the purpose, if none of the condition is matched it will default the output to blank:
DECODE(true,
o_Field_DRC_Choice_Eligible__c = 'Yes','Y',
o_Field_DRC_Choice_Eligible__c = 'No', 'N',
ISNULL(o_Field_DRC_Choice_Eligible__c),'',
'')

OBIEE Case Statement

I'm trying to use a Case formula to evaluate a date but it's erroring out every time. Not sure where I'm going wrong.
1/1/9999 is a date.
Code:
CASE
WHEN "Item "."Store OOS" = 1/1/9999
THEN 'repln'
ELSE 'Fashion'
END
CASE WHEN "Item"."Store OOS" = date '9999-01-01' then 'repln' ELSE 'Fashion' END

regexp_similar '^.$' issues in teradata

For data scrubbing I have lot of hard coded values in my program. I am trying to put those values into a table. One of the conditions for this scrubbing is to find the length of the character and code (character_length(name) = 1).
But when I try to emulate the this by using ^.$, it is not catching values like ¿, ¥, Ã
please let me know if I am doing something wrong .
When I run below code and I see this 3 values ¿, ¥, Ã
select name from email_table
where character_length(name) = 1
and name not in
(select name from email_table
where regexp_similar(translate(name USING LATIN_TO_UNICODE WITH ERROR),'^.$', 'i') = 1)
It seems like the issue is due to version.
We have TD14 and TD 15 on different servers and I did following query
select case when regexp_similar('¥','^.$', 'i')=1
then 'Y'
else 'N'
end as output;
In case of TD 14, I get output as 'N' and in case of TD 15 answer is 'Y'.