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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creation of a variable and use it to color table rows

Hi all,

I'm new to this forum and relative new the QlikView. I've got a question about the creation and usage of variables and I hope you can give me some hints into the correct direction. At the moment, I use a standard load format to load my data (from excel and an Oracle db). To display this data, I use the 'Standard Table Graph' to display these values. Recently, I discovered that I can color these values according to an expression.

However, I've got a question about creation a new variable in a load script (per object: Artikelnummer) dynamically (so, a expression in the load like: value = (x * y) / z). I plan to use this value to define in which color my table row has to be painted. X, y and z have to be values from the excel file or Oracle database.

Could you point me to any documentation describing this process or give me a simple example? Thank very much in advance!

Martijn te Molder



10 Replies
sparur
Specialist II
Specialist II

If I understand, you can use like this:

LOAD

X, Y, Z,

X*Y/Z AS value

FROM Excel.xls...

If I misunderstood, please post your qvw example

Not applicable
Author

Hello,

thank you for the quick reply! Would you like me to post the whole import script, or the file itself? I tried to create a new variable in the load script, but it didn't work.

Regards,

Martijn te Molder

sparur
Specialist II
Specialist II

please, post your qvw

Not applicable
Author

Hereby, an example of my project. I coudn't send the original due to the data content. This version is an similar version. I would like to color the items in the row, depending on a new dynamic variable, created in the load script per object. The formula can be simple (like artikelnummer * 2).

Kind regards,

Martijn

sparur
Specialist II
Specialist II

see in attachment.

I don't understand how you want manage color, but I create a example with green color for last column (see backgroung color expression in last expression)

Not applicable
Author

Thank you for your answer, but I'm afraid that I didn't solve my 'problem'. It seems to be that my explanation isn't clear:

I know how to change (background) colors in tables etc. However, I want to change the background color of tables, depending on a new variable. So I wan't to calculate the variable once per object, and use it to make a simple color statement. The statement to change the color is:

If( (newValue > 10) , RGB(252,115,98))

So far the easy part. Now, I want to define and calculate this newValue (somewhere, probably in the load script) per object row. So each row in the table, can have this color, or not, depending on the new variable.

I hope this wil make my question more understandable.

Regards,

Martijn

sparur
Specialist II
Specialist II

ok, calculate your new field (as I wrote earlier) in the script:

LOAD

X, Y, Z,

X*Y/Z AS newValue

FROM Excel.xls...

and then check this new value field in background expression.

Not applicable
Author

ok, but is it also possible to paste that into the existing script like:

ODBC CONNECT TO [Excel Files;DBQ=C:\Documents and Settings\martijn.temolder\Desktop\Thinkwise.xls];

SQL SELECT Artikelnummer,

`Artikelomschrijving 1`,

Categorie,

......

(Artikelnummer * 12) AS newValue <<<<----------

FROM `C:\Documents and Settings\martijn.temolder\Desktop\Thinkwise.xls`.`ThinkWise$`;

Because that would be a super sollution!

Not applicable
Author

I solved it, thank you very much! Can resume my work now, thank you again!

Martijn