Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JACKNIEKERK
Creator
Creator

find in string the to use key for connecting to a tabel key

Have to tabel with times a key wich could be like:

000001|001/000007|001/000009|001/000002|001/,000006|001/,000008|002

where 000001/   and 000007/   and  000009/ etc are the needed values   in the string

they must trigger a graphic choice object (see jpg please) based on value

how to set  this to show ?

 

 

 

 

 

Labels (3)
1 Solution

Accepted Solutions
edwin
Master II
Master II

Hi, there are a few missing info from your post - 
1. what is the expected behavior when the dashboard is opened - did you want the specific codes in demo$ to be auto selected?
2. if so, then that happens only on OPEN.  selection is triggered by an action.  so if the user clicks CLEAR - whats the expectation?
3. or did you just want a visualization that shows what the inputted codes are and no matter what the user clicks wont impact the visualization?

either way, hope this helps:

if you which to capture the codes in your script:


 

let demo$='000001|001/000007|001/000009|001/000002|001/000006|001/000008|002';

let count$=SubStringCount('$(demo$)','|'); //counts the codes
//in case you want to save the codes in a table-----
    NoConcatenate
    table:
    load null() as C
    AutoGenerate (0);

    for i$=1 to $(count$)
         Concatenate (table)
         load text(subfield(subfield( '$(demo$)','|',$(i$)),'/',-1))  as C
         AutoGenerate(1);
    next;
//---------------------------------------

//if you just need the codes in a variable-----------
    let codes$='(';

    for i$=1 to $(count$)
         let codes$= '$(codes$)' & text(subfield(subfield( '$(demo$)','|',$(i$)),'/',-1)) & '|' ;
    next;

let codes$=left('$(codes$)',len('$(codes$)')-1) & ')';
//the variable is in a format (xxx|xxx|xxx)
//to allow you to add this in your trigger at open
//to select the codes
//------------------------------------------------------

 

 

having said all that, another option is to not handle the selection of codes in your script, instead just do it in your visualization.  all you need is the variable demo$:

1. create a straight table
2. add the description and code as dimensions
3. add the following expressions:
       = 1  // this allows you to show all codes
        =SubStringCount( demo$, Code&'|')  // this results in 0 or 1 depending if the code is in demo$ or not
4. in presentation hide expression column 1
5 set the 2nd expression as an LED

View solution in original post

6 Replies
Taoufiq_Zarra

@JACKNIEKERK  can you elaborate

can you share the expected output ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
JACKNIEKERK
Creator
Creator
Author

ok please take look at jpg  

 

Taoufiq_Zarra

@JACKNIEKERK 

If I understood correctly you want to convert String from 0001|001/0004|001/0006|001/0005|001/ to 0001 0004 0005 0006 ?

you can use for example this version :

Table:

load *,subfield(FieldTmp,'|',1) as FieldTmp2;
load *,subfield(Field,'/') as FieldTmp inline [
Field
0001|001/0004|001/0006|001/0005|001/
];

Final:
load  concat(FieldTmp2,' ') as NewField resident Table where len(trim(FieldTmp2))>0 group by Field;

drop table Table;

input :

0001|001/0004|001/0006|001/0005|001/

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
JACKNIEKERK
Creator
Creator
Author

let me show how we do it now in visual

 


demo$ = "0001|001/0004|001/0006|001/0005|001/"

For i = 1 To Len(demo$) Step 9
   Itemnumber  = Mid$(demo$, i, 4) 
      For y = chkgroup.LBound To chkgroup.UBound         'this is in qlik the graphic choice object (see 1e jpg please)
         If chkgroup(y).Caption = Itemnumber Then
             chkgroup(y).Value = True ' turn it  on  ,      in qlik it should be a connection to graphic choice object
             Exit For
        End If
   Next y
Next i

thus lookiing for a script wich will extract this in visual and connect and active the chkgroup(x)  on screen

In qlik we load like

Directory;
LOAD @1 as Group,
@3 as GroupName
FROM
[J:\PDS\QMAIN.TXT]
(txt, codepage is 1252, no labels, delimiter is ' ', msq;
// 00001 = BEEF

 


ItemsTabel:
//============================
load
Itemnumber ,
Name ,
Group ; // COULD CONTAIN LIKE "0001|001/0004|001/0006|001/0005|001/"

SQL SELECT * from WEBITEMS;

 

 

 

 

 

 

edwin
Master II
Master II

Hi, there are a few missing info from your post - 
1. what is the expected behavior when the dashboard is opened - did you want the specific codes in demo$ to be auto selected?
2. if so, then that happens only on OPEN.  selection is triggered by an action.  so if the user clicks CLEAR - whats the expectation?
3. or did you just want a visualization that shows what the inputted codes are and no matter what the user clicks wont impact the visualization?

either way, hope this helps:

if you which to capture the codes in your script:


 

let demo$='000001|001/000007|001/000009|001/000002|001/000006|001/000008|002';

let count$=SubStringCount('$(demo$)','|'); //counts the codes
//in case you want to save the codes in a table-----
    NoConcatenate
    table:
    load null() as C
    AutoGenerate (0);

    for i$=1 to $(count$)
         Concatenate (table)
         load text(subfield(subfield( '$(demo$)','|',$(i$)),'/',-1))  as C
         AutoGenerate(1);
    next;
//---------------------------------------

//if you just need the codes in a variable-----------
    let codes$='(';

    for i$=1 to $(count$)
         let codes$= '$(codes$)' & text(subfield(subfield( '$(demo$)','|',$(i$)),'/',-1)) & '|' ;
    next;

let codes$=left('$(codes$)',len('$(codes$)')-1) & ')';
//the variable is in a format (xxx|xxx|xxx)
//to allow you to add this in your trigger at open
//to select the codes
//------------------------------------------------------

 

 

having said all that, another option is to not handle the selection of codes in your script, instead just do it in your visualization.  all you need is the variable demo$:

1. create a straight table
2. add the description and code as dimensions
3. add the following expressions:
       = 1  // this allows you to show all codes
        =SubStringCount( demo$, Code&'|')  // this results in 0 or 1 depending if the code is in demo$ or not
4. in presentation hide expression column 1
5 set the 2nd expression as an LED

Kushal_Chawda

@JACKNIEKERK  What is the actual expectation is not clear here.  Would be good if you can show snippet of your sample data and then clearly state the expectation as what you want to achieve