Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
prieper
Master II
Master II

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
prieper
Master II
Master II

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

Not applicable
Author

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

prieper
Master II
Master II

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

Not applicable
Author

ok thank i will try this