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

Compare file name without the a sub string in it's name

Hi,

I have a files with this name formats:

ab_cd_afd_2013311214304567

ab_afd_2013311214304567

etc.

Also, I have a variable containing a string with a file name disregarding the time stamp. (vFileName = 'ab_cd_afd')

I want to compare between them.

which function should I use?

Thanks,

Boris 

1 Solution

Accepted Solutions
MVP
MVP

Re: Compare file name without the a sub string in it's name

Your timestamp is of fixed length, right?

Try

=left(Filename, len(Filename)-17)

edit: and to compare to your variable:

=if( left(Filename, len(Filename)-17) = vFileName, THENBRANCH, ELSEBRANCH)

5 Replies
MVP
MVP

Re: Compare file name without the a sub string in it's name

Your timestamp is of fixed length, right?

Try

=left(Filename, len(Filename)-17)

edit: and to compare to your variable:

=if( left(Filename, len(Filename)-17) = vFileName, THENBRANCH, ELSEBRANCH)

Not applicable

Re: Compare file name without the a sub string in it's name

What about the file extension?

MVP
MVP

Re: Compare file name without the a sub string in it's name

Which file extension, can't see the extension in your above samples.

If you need to extract above filenames from a full path with extensions, have a look at your other current thread;-)

Not applicable

Re: Compare file name without the a sub string in it's name

That one is talking about ignoring the folders and the extension.

here I asked how to ignore the time stamp which is with the file name itself.

and the extension is csv.

I guess just change the 17 to 21?

MVP
MVP

Re: Compare file name without the a sub string in it's name

Yes, 21 should work for an extension '.csv' (four characters).