Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
beck_bakytbek
Master
Master

to create a new field in depence on another fieldname

Hi Folks,

i got a situation, namely my table does look like:

ID, USERFIELD1, USERFIELD2

1,           70,                    30

2,           80,                    20

in the row with ID = 1, the number 70 belongs to engineer, the number 30 belong to architect.

i want to achieve this output:

ID, USERFIELD1, NewField_1,   USERFIELD2,     NewField_2

1,           70,           engineer                30                 architect

2,           80,           engineer                20                 architect

and namely if i select 70, i want to see: the engineer, i know, it does look a bit strange, but i have only this table. can i create such newfields?

Thanks a lot for your help

Beck

16 Replies
its_anandrjs

In your table 70 belongs to engineer, the number 30 belong to architect.

And how comes 80 belongs to engineer and 20 belongs to architect

2,          80,          engineer                20                architect

beck_bakytbek
Master
Master
Author

Hi Anand,

thanks a lot for your responce,

these 2 fields are in formular: in my formular i have these fields, but in the table i dont have any ids, my developer made this strange table.

in the table there are 2 Fields: USERFIELD1 and USERFIELD2, the USERFIELD1 belongs to Engineer and USERFIELD2 belongs to architekt,  and all values, that i type in USERFIELD1 belongs to engineer and all values that i type in USERFIELD2 belongs to architect.

do you have any idea?

thanks a lot

Beck

swuehl
MVP
MVP

I don't really understand what you want to achieve, but maybe try something like

TRANSFORMED:

LOAD ID, USERFIELD1 as VALUE, 'engineer' as TYPE

FROM YourInputTable;

CONCATENATE (TRANSFORMED)

LOAD ID, USERFIELD2 as VALUE, 'architect' as TYPE

FROM YourInputTable;

beck_bakytbek
Master
Master
Author

HI Stefan,

Thanks a lot for your response and feedback, i want to create on the base of Field1 the new Field: Engineer (ich wollte lediglich aufgrund des Feldes: USERFIELD1 ein neues Feld: Engineer erstellen, um dann später dieses Feld mit dem anderen Feld zu verknüpfen, so dass ich das Feld: Ingineer aus einer anderen Tabelle mit den Werten aus dem Feld: USERFIELD1: 70, 80 verknüpfen kann.)

Thanks a lot

Beck

swuehl
MVP
MVP

Sorry, I am still confused, but achieving the output you requested originally is easy, just create the two new fields with constant values:

ID, USERFIELD1, NewField_1,  USERFIELD2,    NewField_2

1,          70,          engineer                30                architect

2,          80,          engineer                20                architect



LOAD ID, USERFIELD1, 'engineer' as NewField_1, USERFIELD2, 'architect ' as NewField_2

FROM YourInputTable;


But that's probably not what you need to solve your issue, so please detail your complete requirements, e.g. how you need to link the tables.

beck_bakytbek
Master
Master
Author

So Stefan,

maybe i am doing this issue wrong,

i got 2 tables:

tab1:

Tarif, Ansatz, Typ

5, 100, engineer,

6, 80, architect

and tab 2:

ID, USERFIELD1, USERFIELD2  --------> where USERFIELD1 is for engineer, and USERFIELD1 is for architect

1,  70,  30

2,  80, 20

as you see, on the base of these table i am not able to concatenate them. my issue was and is, to concatenate the Field: Tarif from Tab1 with Tab2.

swuehl
MVP
MVP

Maybe create two mapping tables:

MAP1:

MAPPING LOAD

Ansatz, Tarif

RESIDENT tab1

WHERE Typ = 'engineer';

MAP2:

MAPPING LOAD

Ansatz, Tarif

RESIDENT tab1

WHERE Typ = 'architect';

LOAD

ID, USERFIELD1, USERFIELD2,

ApplyMap('MAP1',USERFIELD1) as EngineerTarif,

ApplyMap('MAP2',USERFIELD1) as ArchitectTarif

RESIDENT tab2;


DROP TABLE tab2;

beck_bakytbek
Master
Master
Author

Thanks a lot Stefan,

i tried this procedure, but i have this output, there is a deviation in the table

test 2.PNG

swuehl
MVP
MVP

I guess you need

ApplyMap('MAP2',USERFIELD2) as ArchitectTarif

.. and an entry in your mapping tables for all values.