Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
I have below script with the help from Staffen and HIC which using loop to load multiple raw data , is work fine.
FOR i=0 TO NoOfRows('FileList_Sales') -1
LET vFile = PEEK('FileName_Sales', $(i), 'FileList_Sales');
For each vFileName in FileList('$(vRAWPath)*.txt')
if(subfield(subfield('$(vFileName)','\',-1),'.',1) = '$(vFile)') then
sales:
LOAD
FileBaseName() as SOURCE,
'SALES' as table,
@50:60T as [date],
@10:38T as [COMPANY],
@307:312T as [grouping],
ApplyMap('MapGroup_SG',@307:312T) as [GROUP_CLASS_TDS],
@121:133T as [cost]
FROM "$(vFileName)" (ansi, fix, no labels, header is 0, record is line);
endif
Next vFileName
next i
My issue is when i using below script to recode grouping to GROUP_CLASS_3 Is not return correct value.
sales_G:
LOAD grouping,
if (SOURCE='Q_DOD_2016',ApplyMap('MapGrouping_SG',grouping),
if (SOURCE='Q_FCKL09',ApplyMap('MapGrouping_MY',grouping),
)) as [GROUP_CLASS_3]
resident sales;
Hope you can advise me.
enclosed my QVW
Paul
Ok , let me explain
*First, all your conditions are fine
*You have created the sales_G table and liking the sales table via grouping
*grouping field doesn't have the unique key because of which it showing all the related files associated via
grouping
*What is did is in the new table sales_G I created the NEW_SOURCE so that will get the right combination
one more way to do this is
in the sales table create a key like
SOURCE&'-'&grouping as KEY
and create similar key and an indicator like below in sales_G table
SOURCE&'-'&grouping as KEY,
'sales_G ' as Indicator,
and use the Indicator in set analysis to get the rite data ...
Hope you understand now.
Hi Avinash
Wow your understanding of data model is very well. In the first place how do know figure out that link issue ? I just want to learn from you how you do trouble shooting.
Does the way I do the recode it is call partial reload or resident load ?
Paul Yeo
DIrector
TDS Technology (S) P/L
Whatsapp +659:261804
It comes by experience
*First I checked how is the data
*Then saw what the results your getting , you had both the values and then I checked the mapping key and got the issue from their
I suggest you to verify it step by step the is the best approach
if you have got the answer mark the correct answer and close this thread
Hi Sir
Sorry to trouble you again.
I just got internet , and i have check the result . I notice that the result is still wrong.
Kindly note that GROUP_CLASS1 return correct value , but GROUP_CLASS3 return wrong value.
As when grouping = 1 , for Q_DOD_2016 should be recode to G1-SG
As when grouping = 1 , for Q_FCKL09 should be recode to G1-MY
Kindly take a look at the enclosed QVW. Refer to Table 1. I am using the QVW you send me.
Thank you for your help.
Paul
check this one
Hi Avinash
I saw you create a key to link the 2 table. Thank you very much finally now working fine , i can sleep well .
Paul
Aha nice ..have a good sleep