Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

If Statement: tMap Expression Builder

I am trying to extract data from a database and build an expression to convert into the correct ouptut format, but i am having difficulty. My project is in Java.
The data is stored as 'string' values in the input database and is in the format:
CISR_VER
2605
2709
0
2803
3001
0
3002
Where the first 2 digits relate to the year (from a base of 1980) and the last two digits relate to the period/month (1 to 12). Therefore 2605 := Year 2006, Period 05...and 3002 := Year 2010, Period 02 and a 0 is blank or no data held.
The output i am trying to achieve is a column in the format
05/2006
09/2007
null or blank
03/2008
01/2010
null or blank
etc....
I have a tMap that trims the last two digits and stores them in Var.Month (i can use the: Integer.parseInt(Var.Month) to convert to an integer)
I have another variable Var.Year that takes the first two digits, converts them into Integer format and adds 1980.
My problem is that where there is a zero in the input source i am getting a 1980 in the output where i need it to be blank/null. I have tried to build an IF function against the expression but cant seem to get the correct syntax.
Is there an easier way to do this in one expression that converts the input to an integer and can trim the digits and add the 1980 base year and add the '/'??
Any help much appreciated!
Labels (2)
21 Replies
_AnonymousUser
Specialist III
Specialist III
Author

i have a question..
suppose my file have below format(file having different batches) having different schemas for each record type
5200ASDCRSFTHNJUYRE ACH INS PREM        9005900018CORINS. PREM.170315170317   1021000021441991
6270000028027524845075       0000000000094139985                              1021000021441991
798C01071000010027138      111900656878086567                         CHANGE63802E000021441991
6270000028027524845075       0000000000094139986                              1021000021441992
798C01071000010027139      111900656878086567                         CHANGE63802E000021441992
820000001000000014000000000000000000000000009005900018                         021000021441991
so I need to apply a logic to map out certain fields from different record types.How will I do it. plz help. how should I convert the format YYMMDD to MM/DD/YY in tmap. how to use looping to access this type of records bcoz record 6 and 7 come alternatively in each batch.
TRF
Champion II
Champion II

@Swiggy, could you open a new post with this subject?