Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi friends,
I would like to know whether we can set a field after each document load. Let me explain the scenario in detail below:
I have a set of files in a folder like file1.txt, file2.txt, file3.txt, etc.,
I will be loading these files to the Qlikview like:
Load * from file*.txt;
Now I need to add a field to add the file name that I m loading.
My output should be like,
field1 field2 field3
x 2 file1
y 45 file1
z 8 file2
a 8 file3
I need field, field3 which will be added dynamically.
Or is there any other way to set a value to check end of file and use that in an another load statement.
Thanks in Advance
Thanks,
Leni Balakrishnan
Hi,
You can use the function filename().
example:
Load
Field1,
Field2,
filename() as Field3 //This will store the file name to your field3
from file*.txt
Regards,
Alex
Hi,
You can use the function filename().
example:
Load
Field1,
Field2,
filename() as Field3 //This will store the file name to your field3
from file*.txt
Regards,
Alex
Thanks Alex.
Let me try this solution and get back to you
Use this in load statement
SubField(Mid(FileName(),Index(FileName(), '\', -1) +1), '.', 1) as file_name
Thanks Sivaraj
Did you already get a right answer?
or is mine or Sivaraj's answer not what you are looking for?
Regards,
Alex
Yes this is the thing I looked for.
But I need to compare this value in an another load statement to check whether the value came from same file or an another file.
Regards,
Leni
Okay, when you finished checking please pick either mine or Sivaraj's answer to close the thread. So other users with the same problem can view the answer.
Thanks and Regards,
Alex