Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ethan0079
Contributor II
Contributor II

Force a value after load

Hello,

I would like to force the value of NbrLits to 6 for the field %KEY_Service = USI

Ethan0079_0-1665643256127.png

 

 

 

Service:
LOAD DISTINCT 
	%KEY_Service, 
    NbrLits, 
    %KEY_Service as Service
FROM 
    [lib://PROJECT/Artemis 7_7/02 Transform/QVD/DimService.qvd](qvd)
Where 
    %KEY_Service='US1D' or 
    %KEY_Service='US2'or 
    %KEY_Service='US3' or
    %KEY_Service='US4' or
    %KEY_Service='USRZ' or
    %KEY_Service='MAT' or
    %KEY_Service='USI';

 

 

Thanks in advance !
Ethan

 

Labels (2)
1 Solution

Accepted Solutions
sidhiq91
Specialist II
Specialist II

@Ethan0079  Please follow the Script below used in the Back end:

NoConcatenate
Temp:
Load * inline [
%Key_service,NbrLits, Service
US3,28,US3
US1,0,US1
US4,14,US4
USRZ,14,USRZ
US2,33,US2
MAT,13,MAT
US1D,11,US1D
];

NoConcatenate
Temp1:
Load %Key_service,
if(%Key_service='US1',6,NbrLits) as NbrLits,
Service

Resident Temp;

Drop table Temp;

Exit Script;

If this resolves the issue, please like and accept it as a solution.

sidhiq91_0-1665645929296.png

 

View solution in original post

6 Replies
Mark_Little
Luminary
Luminary

Hi @Ethan0079 

Depends on the data, is that a dimension or  a measure? I would look at doing it in script and concatenate the value on you want. Otherwise you would need a calculated measure or dimension wrapped in an if statement

Ethan0079
Contributor II
Contributor II
Author

Salut  @Mark_Little 

La table de service est une dimension.

 

 

sidhiq91
Specialist II
Specialist II

@Ethan0079  Please follow the Script below used in the Back end:

NoConcatenate
Temp:
Load * inline [
%Key_service,NbrLits, Service
US3,28,US3
US1,0,US1
US4,14,US4
USRZ,14,USRZ
US2,33,US2
MAT,13,MAT
US1D,11,US1D
];

NoConcatenate
Temp1:
Load %Key_service,
if(%Key_service='US1',6,NbrLits) as NbrLits,
Service

Resident Temp;

Drop table Temp;

Exit Script;

If this resolves the issue, please like and accept it as a solution.

sidhiq91_0-1665645929296.png

 

BrunPierre
Partner - Master II
Partner - Master II

@Ethan0079 if it's just this one value you intend to replace, perhaps an IF() would suffice

IF(Match(%KEY_Service,'USI'),6,NbrLits) as NbrLits

Otherwise, if there's quite a number, an appropriate way is to create a mapping table with the old and new values, and then perform a lookup to change all the old values to the new values.

Ethan0079
Contributor II
Contributor II
Author

hi @sidhiq91 

Thanks for your answers it's works !

I juste have to change de name of the Table and %Key_service to %KEY_Service


sidhiq91
Specialist II
Specialist II

@Ethan0079  You can also please like the post. Thanks