Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing field values

Hello,

I have two tables that are related by the field id:

Table 1

idoffer_type
1A
2B
3C

Table 2

idClick_type
12
14
23
24
33
12
33

I need to change the values from the field click_type based on the offer type. For example:

Offer_type A has Click_type 2 and 4. And I want to replace 2 for 1 and 4 for 2.

Offer_type C has Click_type 3. And I want to replace 3 for a 5.

New Table 2:

idClick_Type
11
12
23
24
35
11
35

How can I use mapping here? I need this changes to be made in the loading script.

Thank you,

Juan.

4 Replies
Not applicable
Author

simply

Table1:

LOAD * Inline [

id,    offer_type

1,    A

2,    B

3,    C

];

Table2:

LOAD *,RecNo() as    Click_type_new 

Inline [

id,    Click_type

1,    2

1,    4

2,    3

2,    4

3,    3

];

then output like this

idClick_typeClick_type_new
-
121
142
233
244
335
Not applicable
Author

Hi,

I agree with vishwaranjan's point.

Regards

Garry

Not applicable
Author

Hello guys,

Your solution was right for the previous example, but I have unlimited records in table 2. That solution returns the row number, right? I just edited the example with new records for table 2 so you can see that the solution is not a secuencial number. Any ideas?

Thank you,

Juan.

Not applicable
Author

Hello,

I can't open your file because I have the free edition.  Could you post your solution in text please?

Thank you,

Juan.