Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

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

1 Solution

Accepted Solutions
marcus_sommer

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

- Marcus

View solution in original post

10 Replies
marcus_sommer

Hi DataNibbler,

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

- Marcus

alexandros17
Partner - Champion III
Partner - Champion III

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
Champion
Champion
Author

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
Champion
Champion
Author

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

marcus_sommer

Hi DataNibbler,

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

- Marcus

datanibbler
Champion
Champion
Author

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

marcus_sommer

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

- Marcus

alexandros17
Partner - Champion III
Partner - Champion III

I use 11.20 SR5 ....

datanibbler
Champion
Champion
Author

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