Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

datanibbler
Esteemed Contributor

More elegant way of doing this - String functions?


Hi,

I often have filepath_variables that look sth. like this:

>> \\srn2\production\01_bimmelbam\bumbum\file.xls <<

These file_paths, as I said, are saved as variables in INCLUDE_files so as to have each piece of information in only one place.

Sometimes, however, I have to use the DIRECTORY command in the script or I have to build a search_mask for some loop,

so I only need the first part(s) of this:

>> \\srn2\production\01_bimmelbam\bumbum <<

I don't know how to do this in the most elegant way in QlikView - the best way, I think, would be to use a function to turn this string around, just cut off the (then first) part and turn it round once again - but to my knowledge, a function like REVERSE or other is not available in QlikView, is it?

Thanks a lot!

Best regards,

DataNibbler

Tags (1)
1 Solution

Accepted Solutions

Re: More elegant way of doing this - String functions?

Try it with single-quotes outside the variable: '$(v_Pfad_Basisdaten)'

- Marcus

10 Replies

Re: More elegant way of doing this - String functions?

Hi DataNibbler,

you could use subfield('\\srn2\production\01_bimmelbam\bumbum\file.xls', '.', 1).

- Marcus

Re: More elegant way of doing this - String functions?

This one could be the solution

Mid('\\srn2\production\01_bimmelbam\bumbum\file.xls',1,FindOneOf('\\srn2\production\01_bimmelbam\bumbum\file.xls' , '\', -1) )

datanibbler
Esteemed Contributor

Re: More elegant way of doing this - String functions?

Hi Marcus,

I have tried that already - that way I can split out the first part and end up with

>> \\srn2\production\01_bimmelbam\bumbum\file <<<

=> and from there?

I don't want the last part of it, the > \file < part, so that I can use the DIRECTORY command or build a search_mask.

datanibbler
Esteemed Contributor

Re: More elegant way of doing this - String functions?

Hi Allessandro,

I didn't know that variation of the FINDONEOF_function yet. It looks good, though. I take it that counts from the end of the string (negative numbers as parameter)?

Let's see. That one is not in my help_file, either. Is it in yours? I do have a VERY outdated client installed here. Getting any new software is a mayor effort in this place ;-)

Thanks a lot!

Best regards,

DataNibbler

Re: More elegant way of doing this - String functions?

Hi DataNibbler,

findoneof() is a qv standard-function, instead this function you could also use index().

- Marcus

datanibbler
Esteemed Contributor

Re: More elegant way of doing this - String functions?

Hi,

I have now implemented the following in my script (based upon the filepath_variable that I have):

>> LET v_searchmask_pre = LEFT($(v_Pfad_Basisdaten), FindOneOf($(v_Pfad_Basisdaten), '\', -1) <<

For some reason, it's not working yet - the script is running all right, but I cannot find this variable.

Can you give me a hint as to what's wrong here?

Thanks a lot!

Best regards,

DataNibbler

Re: More elegant way of doing this - String functions?

Try it with single-quotes outside the variable: '$(v_Pfad_Basisdaten)'

- Marcus

Re: More elegant way of doing this - String functions?

I use 11.20 SR5 ....

datanibbler
Esteemed Contributor

Re: More elegant way of doing this - String functions?

Thanks!

I was just starting to experiment with quotes outside the whole thing - but around the path_variable itself ...

Well, it works now.

Thanks a lot!

Best regards,

DataNibbler

Community Browser