Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current selections delimiter

Hi,

I want to specify the delimiter for the values selected. In the attached image,

KBS AMERICA, INC  and

MULTIPOLE INTERNATIONAL LTDA  are two different partner names. But,

since a comma appears in the name , and the default delimiter is a comma,

we cannot split it around comma. What other option do I have to get the partner names?

This is the C# code we use via API...

  IReturn5 selections = axQlikOCX1.ActiveDocument.GetCurrentSelections();

  IList selectionValues = (IList)selections.Selections; --> this returns the values delimited by comma

IList selectedFields = (IList)selections.VarId;

Thanks,

Anju

1 Solution

Accepted Solutions
Not applicable
Author

Hi All,

I was able to find a solution.

Steps:

1) Define a variable say , 'vSelections' under Settings -> Variable Overview

        with definition =GetCurrentSelections('#`','@`','`~') [pls see function description in reference doc]

2) I am using C# via QMSAPI.

    Some code tidbits :

               string selection_content = axQlikOCX1.ActiveDocument.Variables("vSelections").GetContent().String; --> fetch variable contents

               string[] tag=Regex.Split(selection_content, rec_sep); -->split around various separators..

   

              where I have defined some variables as follows:


              private string rec_sep = "#`", tag_sep = "@`", value_sep = "`~";

             and so on...

Additionally, I can give a 4th parameter for the function ...GetCurrentSelections('#`','@`','`~',10)..So, here, 10 is the maximum number of individually listed selections..i.e, if I select 11...it will be displayed as 11 of 45 ..etc...

Regards,

Anju

View solution in original post

7 Replies
sujeetsingh
Master III
Master III

It means you want to split the names with comma as deliminiter .

It seems tough to do

Not applicable
Author

Yes, it is...been looking for a solution for quite a few days.

in the desktop environment, we can use GetCurrentSelections this way

GetCurrentSelections(':','=','::') whereby we can specify the default delimiter.

But , QMSAPI does not support the overloaded version!

Not applicable
Author

Hi Son of Sardar,

I just added the attachment now.

Regards,

Anju

Not applicable
Author

Where is the setting for default delimiter?

sujeetsingh
Master III
Master III

Anju tell one thing that what you really want as output.

Not applicable
Author

Using API, I want

KBS AMERICA, INC <separator>

MULTIPOLE INTERNATIONAL LTDA  instead of

KBS AMERICA, INC,MULTIPOLE INTERNATIONAL LTDA

where I can set the <separator>

Not applicable
Author

Hi All,

I was able to find a solution.

Steps:

1) Define a variable say , 'vSelections' under Settings -> Variable Overview

        with definition =GetCurrentSelections('#`','@`','`~') [pls see function description in reference doc]

2) I am using C# via QMSAPI.

    Some code tidbits :

               string selection_content = axQlikOCX1.ActiveDocument.Variables("vSelections").GetContent().String; --> fetch variable contents

               string[] tag=Regex.Split(selection_content, rec_sep); -->split around various separators..

   

              where I have defined some variables as follows:


              private string rec_sep = "#`", tag_sep = "@`", value_sep = "`~";

             and so on...

Additionally, I can give a 4th parameter for the function ...GetCurrentSelections('#`','@`','`~',10)..So, here, 10 is the maximum number of individually listed selections..i.e, if I select 11...it will be displayed as 11 of 45 ..etc...

Regards,

Anju