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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Mkrishna
Contributor
Contributor

how to load multiple header ,detail and footer records into a file

hi, iam having a data in a file with multi schema like header and detail&footer now

1.how can i load this data into a single file

see my input (Positional file)

HA00000000051070UPAULINA             Wdavid                 john

DA00000000051070S000009003RESSupply    01012015Summer Charge   240 kwh 200 

DA00000000051070S000009003RESSupply    01012015Summer Charge   240 kwh 220

FA00000000051070S000009003M000004576ELECT1 010120150131201531

 

HA00000000155650UPAULINA             Wraj                 warner

DA00000000155650S000009003RESSupply    01012015Summer Charge   140 kwh 110 

DA00000000155650000009003RESSupply    01012015Summer Charge   340 kwh 300

FA00000000155650S000009003M000004576ELECT1 010120150131201531

like data is for more than one customer with multiple header,detail&footer 

Labels (2)
23 Replies
vboppudi
Partner - Creator III
Partner - Creator III

Hi Krishna,

Means you are receiving multiple files and need to load in single file correct?

Regards,

 

Mkrishna
Contributor
Contributor
Author

Hi Vboppudi,

Exactly you did in the same i did............................

instead of tlog i used tmap and tfileoutputdelimited 

tfileinputmspositional............ tmap.......tfileoutputdelimited ( for Header)

                                  ............tmap.......tfileoutputdelimited (Detail) Appen option used

                                  ............tmap.......tfileoutputdelimited (Footer) Append option used

Problem is i want to load all these header and detail and footer records in to a single file like

it is loading first Header for all the customer  than Detail for all the customer  than Footer for all the customer so on, but i need to load Heade and detail footer for one customer than header and detail footer for another customer so on

 

Mkrishna
Contributor
Contributor
Author

HI vboppudi; 

you got the same out like me but i need like below this ( consider this output)



|HA00000000051070UPAULINA Wdavid john|
|DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200|
|DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220|
|FA00000000051070S000009003M000004576ELECT1 010120150131201531|

 

|HA00000000155650UPAULINA Wraj warner|
|DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110|
|DA00000000155650S00009003RESSupply 01012015Summer Charge 340 kwh 300 |
FA00000000155650S000009003M000004576ELECT1 010120150131201531|

 

A00000000051070 is account number (length is 15)

 

vboppudi
Partner - Creator III
Partner - Creator III

Hi Krishna,

 

I used below job to create single file from multiple input files.

0683p000009Ltus.png

 

tPrejob--> tFiledelete used to delete target file.

Source files:

Customer1.txt

HA00000000051070UPAULINA Wdavid john
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
FA00000000051070S000009003M000004576ELECT1 010120150131201531

 

Customer2.txt

HA00000000155650UPAULINA Wraj warner
DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650000009003RESSupply 01012015Summer Charge 340 kwh 300
FA00000000155650S000009003M000004576ELECT1 010120150131201531

 

Using filelist component, read two files, Used tFileInputFullRow component to read every record in file as single column and loaded this data into file.

 

Customers.txt

HA00000000051070UPAULINA Wdavid john
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
FA00000000051070S000009003M000004576ELECT1 010120150131201531
HA00000000155650UPAULINA Wraj warner
DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650000009003RESSupply 01012015Summer Charge 340 kwh 300
FA00000000155650S000009003M000004576ELECT1 010120150131201531

 

Let me know if this is you expected output.

Regards,

Mkrishna
Contributor
Contributor
Author

HI vboppudi; 

you are Right.........if i have mulitiple input files than ur solution is ok.

But here i have only single input file, having muliptle header,detail footer records for multiple customers

like H and D and F is record_type (column) and next 15 digit length is Account_no (column)

HA00000000051070UPAULINA Wdavid john
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
FA00000000051070S000009003M000004576ELECT1 010120150131201531

HA00000000155650UPAULINA Wraj warner
DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300
FA00000000155650S000009003M000004576ELECT1 010120150131201531

 

Anonymous
Not applicable

I'll add few images, may be that will help you understand:0683p000009Ltqh.png

 

 

0683p000009Ltv7.png

 

 

0683p000009LsjR.png

 Note how I only created 2 columns in positional file 1 st for rowtype(1) and second for content(68), since its fixed length the overall length  row wont go above 69 in this case[ take max row length as precaution and trim the data afterwards]

If you wish you perform operations on any data you can use " String substring(int start, int end)"  method to extract certain data and perform calculations.

 

Hope it helps you.

 

Thanks

Aranax

 

 

 

vboppudi
Partner - Creator III
Partner - Creator III

Hi Krishna,

 

Please provide some sample data from our source and expected output. Because what i understand is, the data you provided is your source data and that data is present in your expected order like for every customer first Header, Detail and footer records. If your source data is something different like below

HA00000000051070UPAULINA Wdavid john

HA00000000155650UPAULINA Wraj warner
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220

DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300

FA00000000051070S000009003M000004576ELECT1 010120150131201531
FA00000000155650S000009003M000004576ELECT1 010120150131201531

 

and you expected output is like below

HA00000000051070UPAULINA Wdavid john
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
FA00000000051070S000009003M000004576ELECT1 010120150131201531

HA00000000155650UPAULINA Wraj warner
DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300
FA00000000155650S000009003M000004576ELECT1 010120150131201531

 

Then logic will be different. Please conform this.

 

Regards,

Mkrishna
Contributor
Contributor
Author

Hi Vboppudi,  this is my input i need to load into a file 

Iinput

HA00000000051070UPAULINA Wdavid john
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
FA00000000051070S000009003M000004576ELECT1 010120150131201531

HA00000000155650UPAULINA Wraj warner
DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300
FA00000000155650S000009003M000004576ELECT1 010120150131201531

needed output: along with input some seqno

1   HA00000000051070UPAULINA Wdavid john
1 1 DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
1 2 DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220
1 1 FA00000000051070S000009003M000004576ELECT1 010120150131201531

2    HA00000000155650UPAULINA Wraj warner
2 1 DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
2 2 DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300
2 1 FA00000000155650S000009003M000004576ELECT1 010120150131201531

i used tfileinputmspositional----------tmap-----tfileoutputdelimited  ( H) no append

                                            ----------tmap---=--tfileoutputdelimited (D) append

                                           -------------tmap----tfileoutputdelimited (F) append

my output is like 

HA00000000051070UPAULINA Wdavid john

HA00000000155650UPAULINA Wraj warner
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 200
DA00000000051070S000009003RESSupply 01012015Summer Charge 240 kwh 220

DA00000000155650S000009003RESSupply 01012015Summer Charge 140 kwh 110
DA00000000155650S000009003RESSupply 01012015Summer Charge 340 kwh 300

FA00000000051070S000009003M000004576ELECT1 010120150131201531
FA00000000155650S000009003M000004576ELECT1 010120150131201531

vboppudi
Partner - Creator III
Partner - Creator III

Hi Krishna,

I have already provided solution for this in other post.

 

Regards,

 

Mkrishna
Contributor
Contributor
Author

Hi vboppudi,

 See my screenshot here first all Record "H" will be loading in the output file and "D" record will be loaded and "F" record will be loading.

 

But my requirement is first record "H" and "D' and "F'' for one customer account and  record "H" and "D' and "F'' for second  

customer so on in the single output file

 

 

.0683p000009LsR9.png