Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Get a value in script

Capture.PNG

The first field is named "hierarchie", the second "name", the third "code".

I put dynamicly the values of "name" with some if who get "code" values.

You can see that "hierarchie" can have 1 or 2 corresponding values with "code" and "name".

I want to regroup each "name" in the same name where "hierarchie" have same values like this :

H2001119 |              22       |        22                    become          H2001119       |        rgpRHF     |     22

                  |    rgpRHF        |        21                                                                                             |     21

But the "code" 22 can have multiple name, (look at the picture) he can be named rgpRHF, rgpGMS, ...

So i need to know what is the name of the next value. Can you help me please ?

Thanks for yours answers

1 Solution

Accepted Solutions
Highlighted
Master II
Master II

Re: Get a value in script

hmmm,

If the "22" comes always before the name, then you may load the table in descending order,

check whether code = name and then take the previous name instead.

Might be:

Data_sorted:

NOCONCATENATE LOAD

hierarchy,

IF(name = code, PREVIOUS(name), name)          AS name,

code;

LOAD

hierarchy, name, code

RESIDENT OldTable

ORDER BY hierarchy, name DESC;

DROP TABLE OldTable;

Edit: Added tablenames, and drop

View solution in original post

4 Replies
Highlighted
Master II
Master II

Re: Get a value in script

This is a problem in reading the data? Is there an identifyer (numeric, certain text-pieces)?

Highlighted
Not applicable

Re: Get a value in script

the problem is : i don't know how to take the second value of the field "name" where there is a second value.

I just want to regroup my values in the same field.

"hierarchie" is a loaded field who contains only values like H2xxxxxx

"code" is a loaded field who contains only values like 20,21,22,23,24,25

"name" is a created field who display an name for each "code" 's value.

BUT ! the code 22 can appear in differents "hierarchie" so he must be named and he obligatly must be named like the other value in the same "hierarchie" 's field

Highlighted
Master II
Master II

Re: Get a value in script

hmmm,

If the "22" comes always before the name, then you may load the table in descending order,

check whether code = name and then take the previous name instead.

Might be:

Data_sorted:

NOCONCATENATE LOAD

hierarchy,

IF(name = code, PREVIOUS(name), name)          AS name,

code;

LOAD

hierarchy, name, code

RESIDENT OldTable

ORDER BY hierarchy, name DESC;

DROP TABLE OldTable;

Edit: Added tablenames, and drop

View solution in original post

Highlighted
Not applicable

Re: Get a value in script

ok thank i will try this