Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Elements, that change color, depending on cell content

Hello everyone,

I am new to QlikView and I want to implement the following:

I need an element (QlikView-Object), that is a simple rectangle. Further I have an excel-datasource (imported through the "edit script" component, like in the totorial video), which looks like this:

Object  |  State

-----------------

object1 | active

object2 | active

object3 | waiting

object4 | active

object5 | active

object6 | broken

object7 | active

... and so on...

I now want the 7 rectangles, that represent my objects (for now I've just created simple text boxes) to change the color. For example green, if the objects state is active, yellow if the state is waiting and red if the state is broken.

How is that possible?

P.S. The excel-document-import works well so far. I've two tables, one is called Object, the other is called State and I can click on their rows to see which object is in which state and so on.

I would appreciate any help!

1 Solution

Accepted Solutions
fred_s
Partner - Creator III
Partner - Creator III

Hi Eugen,

qv_txt.JPG

This the Text for 'obj6':

='obj6 = ' &

if(only({1<Object={obj6}>}State)='active','active',

if(only({1<Object={obj6}>}State)='waiting','waiting',

if(only({1<Object={obj6}>}State)='broken','broken',

'-'

)))

qv_bgcolor.JPG

And this is the calculated BgColor for 'obj6':

=

if(only({1<Object={obj6}>}State)='active',RGB(0,128,0),

if(only({1<Object={obj6}>}State)='waiting',RGB(255,204,0),

if(only({1<Object={obj6}>}State)='broken',RGB(255,0,0),

RGB(100,100,100)

)))

View solution in original post

13 Replies
fred_s
Partner - Creator III
Partner - Creator III

Hi Eugen,

See attachment..

It's a Pivot table.

Look at the properties, Extensions.

Open the plus sign at the left of State..

object-state-props.JPG

Grtz.

Fred

Not applicable
Author

Hello Fred,

many thanks four your answer! It does almost everything I want. Is it also possible, not to use a pivot table but a kind of simple rectangle? Maybe a text box? In the text box I can't find the option to change the background color based on a condition.

Do you know a way?

fred_s
Partner - Creator III
Partner - Creator III

Hi Eugen,

Check this one; see background color at the left..

qlik-color-textbox.JPG

Grtz,

Fred

Anonymous
Not applicable
Author

On the Text Box Properties

General Tab

Under background select Colour and click the coloured rectangle to the right of it

For Base Colour select Calculated and add your expression.

AbhijitBansode
Specialist
Specialist

There is no option on text box to change the cell color based upon any calculation. However if you want to apply some static background color. you can use "Custom Format Cells" by right clicking on chart.

make sure that from the User Preferences->Design->Always Show Design menu Items option is checked

Not applicable
Author

Thank you very much once again!

But I also have a last question.

Is it possible to assign a text box to a field of my loaded table? For example, if I have the table mentioned in my question, I now want to have 7 text boxes (position arranged by myself), as the table goes from object1 to object7. Each rectangle would represent an object from the list an the color would change, accordingly to the state of the object. For this special example: Text box with objects 1, 2, 4, 5, 7 would be green, 3 would be yellow and 6 would be red.

Is there a possibility to implement that?

Many thanks in advance for your support!

fred_s
Partner - Creator III
Partner - Creator III

Is it possible to send us an example?

Do you know the max number of rows in your table?

Not applicable
Author

Fred Schonenberg &lt;span class=&quot;icon-status-icon icon-partner&quot; title=&quot;Partner&quot;&gt;&lt;/span&gt; schrieb:

Is it possible to send us an example?

Yes, sure! See attached.

I know the maximal number of rows and I want to create each textbox by hand and arrange them independently.

The text values of the text boxes should be set automatically if it is possible somehow.

In the example attached object 1, 3, 4 and 5 would be green. Object 2 would be red and Object 6 would be yellow.

And of course, as soon as I change a state of an object in the xsl table and reload the script, the colors should change as well.

Is it possible to do that?

tobias_klett
Partner - Creator II
Partner - Creator II

Hi Eugen,

put this in the calculated Color of TextBox 1:

if(only({1<Object={obj1}>}State)='active',rgb(0,255,0),rgb(255,0,0))

Regards

Tobias