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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
denny_wu
Contributor
Contributor

Data Reload

Hi There,

I need help from you guys.

i have table something like this:

before.png

RecipeKey related with SpecKey. so, i want to add new column (column name is "Key). that Key value should be first row of SpecKey.

before.png

how to build that script ?

Thanks

Denny Wu

3 Replies
rubenmarin
MVP
MVP

Hi Denny, in script you can do a sorted reload and use Peek() to propagate the value:

https://help.qlik.com/en-US/sense/April2018/Subsystems/Hub/Content/Scripting/InterRecordFunctions/Pe...

If(IsNull(Peek('Key')), Description, Peek('Key')) as Key

Usually you need to group values to 'reset' the propagated value, if not all rows will have the same value.

If(GroupCode<>Peek('GroupCode'), Description, Peek('Key')) as Key

denny_wu
Contributor
Contributor
Author

What do you mean Group values ?
i dont see can group the values, cause all row is related with column RecipeKey.

rubenmarin
MVP
MVP

Just that usually the value changes on some conditions, like taking the first value of each year, if you want the same value in all rows it doesn't matter. It was only an example.