Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Create variable multiple copies of input records

Hi

In my application I have to show status changes. I receive the changes in a message which can capture multiple status changes within the last minute. The status field is a bitset an can contain up to 32 different statuses.

In order to display the data it would be convenient to lookup this status field and create for each changed bit a copy of the message with the according status and the on/off flag.

e.g.
11.09.2009 10:01 1024 (bits 0000 0010 0000 0000)
11.09.2009 10:02 3 (bits 0000 0000 0000 0011)

should become
11.09.2009 10:01 status10 on
11.09.2009 10:02 status 10 off
11.09.2009 10:02 status 1 on
11.09.2009 10:02 status 2 on

Can't figure out how to efficiently do this.

Thanks

Jürg

Tags (4)
1 Solution

Accepted Solutions
vidyut
Contributor II

Create variable multiple copies of input records

Hi,

In case you want to do this in your script, instead of doing it in a chart, there should be simple way using an inline table.

Create a table of different status code and corresponding strings (Use Autogenerate for doing that).

Left Join with the Main Table, this should give you the values automatically.

3 Replies
vidyut
Contributor II

Create variable multiple copies of input records

Use a ValueLoop (1,32) as a dimension, and using that, create your multiple rows.

so, If you have DATE_TIME as Dimension and STATUS as corresponding status, use ValueLoop(1,32) as a additional dimension, and in Expression put If(pick(ValueLoop(1,32),Filter1,...Filter32)&Status=1,'Status '&ValueLoop(1,32)&' is on','Status '&ValueLoop(1,32)& ' is Off')

Let me know how it goes.

Not applicable

Create variable multiple copies of input records

Thanks Vidyut

I assume you refer to a diagram with your solution.

I rather envisioned a solution in the data load script because I will need to keep track of the changes in timely order.

To see whether the status has changed I will need to compare with each read record the new status against the old and then

a) generate an off record for all statuses not active any more

b) generate an on record for all statuses newly set

Jürg

vidyut
Contributor II

Create variable multiple copies of input records

Hi,

In case you want to do this in your script, instead of doing it in a chart, there should be simple way using an inline table.

Create a table of different status code and corresponding strings (Use Autogenerate for doing that).

Left Join with the Main Table, this should give you the values automatically.

Community Browser