Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Use of FileName in script

Hi all,

I have a loop in a dir with FoundFile param which get's a full path with file name into it.

I try to get only the file name, but when I use:

let vTemp3 = filename('$(FoundFile)');

I get NULL in vTemp3.

but in this : let vTemp=  '$(FoundFile)';

I get the correct path.

I tried to remove the single quotes, didn't help.

regards,

Boris

2 Replies
aadilmadarveet
Valued Contributor

Re: Use of FileName in script

Hi,

You might try something like below.

LET vTemp3 = SubField('$(FoundFile)', '\', -1);

Regards,

Aadil

Siva_Sankar
Honored Contributor

Re: Use of FileName in script

Hi,

Try this,

Sub DoDir (Root)

     For Each Ext In 'qvd' // filetype to search for in current directory

          For Each File In FileList (Root & '\*.' & Ext)

                    Files:

                    Load '$(File)' as WayToFile,

                     FileTime('$(File)') as FileTime,

                     Replace(Mid('$(File)',Index('$(File)','\', SubStringCount('$(File)','\'))+1),'.$(Ext)','') AS FileName,

                    Autogenerate 1;

          Next File

     Next Ext

     For Each Dir In DirList (Root & '\*') // searching in subdirs

          Call DoDir (Dir)

     Next Dir

End Sub

Regards.

Siva

Community Browser