Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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

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

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.