Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
I have inline load as under
Mtrl:
Mapping
LOAD * INLINE [
INo, CName
1, 0
2, ThLow
3, ThMin
4, ThMed
];
Where CName column is existing column in database.
What syntax should I use so I can evaluate column CName
Thanks in advance
Indeed, but your explanation is missing a few key elements. For example, what is INo? It seems to be in control but you're not telling us whether it is a selection in the UI (a variable), a column in the same row in the same database table, a column in another database table, something else...
If INo is a column in the same row as CName, then you can use this in your script instead of the Mapping table:
:
Pick(INo, 0, ThLow, ThMin, ThMed) AS CNameValue,
:
or as an expression in a UI object:
=Pick(INo, 0, ThLow, ThMin, ThMed)
Best,
Peter
If the data set is same you want the mapping of Name to INo ...Just interchange the order of columns
And you can do this without changing the INLINE string block, just
LOAD CName, INo INLINE [...
will reverse the column order.
Mind you, a Mapping table will be invisible to any and all except to the ApplyMap() function. ApplyMap() can use any Mapping table defined before the call is made to translate one value into another at a time.
Mapping tables also cease to exist at the end of the current script run. So the QlikView User Interface cannot make use of them. ApplyMap() therefor is a script-only function.
In fact I need the value for specific column (ThLow, ThMin, ThMed) when INo is 1,2 or 3 resp.
Meaning if INo = 1 than 0
INo=2 than whatever the value of ThLow
INo=3 than whatever the value of ThMin
INo=4 than whatever the value of ThMed
Mtrl:
Mapping
LOAD * INLINE [
INo, CName
1, 0
2, ThLow
3, ThMin
4, ThMed
];
Where CName column is existing column in database.
What syntax should I use so I can evaluate column CName
In CName you have values like 0,1,2 or ThLow if its 1,2 etc then
try like this in your FACT table
applymap('Mtrl',CName) as name
The ApplyMap function is used for mapping any expression to a previously loaded mapping table. The syntax is:
applymap('mapname', expr [ , defaultexpr ] )
where:
mapname is the name of a mapping table that has previously been created through the mapping load or the mapping select statement (see Mapping). Its name must be enclosed by single, straight Quotation Marks in Scripting.
expr is the expression, the result of which should be mapped.
defaultexpr is an optional expression which will be used as a default mapping value if the mapping table does not contain a matching value for expr. If no default value is given, the value of expr will be returned as is.
Examples:
// Assume the following mapping table:
map1:
mapping load * inline [
x, y
1, one
2, two
3, three ] ;
ApplyMap ('map1', 2 ) returns ' two'
ApplyMap ('map1', 4 ) returns 4
ApplyMap ('map1', 5, 'xxx') returns 'xxx'
ApplyMap ('map1', 1, 'xxx') returns 'one'
ApplyMap ('map1', 5, null( ) ) returns NULL
ApplyMap ('map1', 3, null( ) ) returns 'three'
Indeed, but your explanation is missing a few key elements. For example, what is INo? It seems to be in control but you're not telling us whether it is a selection in the UI (a variable), a column in the same row in the same database table, a column in another database table, something else...
If INo is a column in the same row as CName, then you can use this in your script instead of the Mapping table:
:
Pick(INo, 0, ThLow, ThMin, ThMed) AS CNameValue,
:
or as an expression in a UI object:
=Pick(INo, 0, ThLow, ThMin, ThMed)
Best,
Peter
Hi Peter
This is the one I want.
With this, I do not need even Mapping load.
Thanks for great help.
Hi Avinash
I appreciate your suggestion and time.
Many Thanks for your time.