Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

File Structure

Hi,

I am having same file but different file structure,

for example:

1) no1_a_31_12_2016

2) no1_no2_a_31_12_2016   (a=filename)

By using sub field i am taking date n filename.

I am receiving file structure mentioned above.i should get the file name for both structure(different structure)

Will u help me in this.

Thanks in advance.

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Sindhu ja,

Try this,

Load

Right(FileBaseName(),10) as Date,

Left(FileBaseName(), Len(FileBaseName()) - 11) as S.NO.

From Source;

If you want to format date field then use the below one.

Date(Date#(Right(FileBaseName(),10),'DD_MM_YYYY'),'Desired Format') as Date

View solution in original post

7 Replies
Anil_Babu_Samineni

Can you provide real data and expected result

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

File structure.JPG

This is the File Format..We are receiving from FTP.Based on this file structure,we are splitting the fields 1007 as s.no and  & 29_3_2017 AS date. Filename as filename.

Instead of 1007 if we receive SOU4_1001 how can i get the field into script.we want to get both structure

Anonymous
Not applicable
Author

you need SOU4_1001 value in s.no? or just want 1001??

Anil_Babu_Samineni

Finally, You have this filelist in Field? I am assuming you must

Can you search on how SubField() function does in Qlikview

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Chanty4u
MVP
MVP

am not sure but you can use FilebaseName() function to get it.

load *,

filebasename()  as Filename,

from....

Best

Chanty

Anonymous
Not applicable
Author

Dear all.Thanks for ur rly.

I mean to say,

For Example;-

1001_29_03_2017

We are using subfield(filename,'_',1) as S.NO.

                      subfield(filename,'_',2) as day.

Month,Year viceversa

Here we are receiving 2 types of file structure. Script should Satisfies both type of file Structure.

For this "1001_29_03_2017 " the script is working fine.

when we receive this type of file structure its is taking 2nd position as day "SOU4_1007_29_03_2017".but here we need SOU4_1007 as S.No

tamilarasu
Champion
Champion

Hi Sindhu ja,

Try this,

Load

Right(FileBaseName(),10) as Date,

Left(FileBaseName(), Len(FileBaseName()) - 11) as S.NO.

From Source;

If you want to format date field then use the below one.

Date(Date#(Right(FileBaseName(),10),'DD_MM_YYYY'),'Desired Format') as Date