Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

original cell value is replaced by expression...

I have a cell value in a straight table.  The original value is "G,3" (no quotes)

What I'm attempting is pass the cell contents and background color in one argument

In this case, the cell value = "G" and the background = 3

My expression to extract the left piece - Left(Cell001,Index(Cell001,',') - 1)

I thought this would get the G and leave the original contents alone after this expression the contents are no longer "G,3" but only "G".

Is there a way to act on the original value so I can get the right piece (i.e. 3) ?

1 Solution

Accepted Solutions
Not applicable
Author

Might not be the only solution but I had to break up the field during the load

Table1:

Load Table1Data,

SubField(col1,',',1) as col1,

SubField(col1,',',2) as col1bg

For the straight table

Add expression - col1

Col1 - Background color - Pick(col1bg,RGB(255,0,0),RGB(255,255,0),RGB(0,255,0),RGB(128,128,128))

Col1 - Text color - Pick(col1bg,White(),Black(),Black(),White())

Not the worst work-around.  Prefer QlikView expressions didn't work like reference base parameters

View solution in original post

5 Replies
Not applicable
Author

Can you please upload the file so we can take a look at it? That makes it much easier to help you.

Not applicable
Author

Can't upload the proprietary qv but this is the cell.

cell.JPG

G is what I want to show - Left(Cell001,Index(Cell001,',') - 1) but when I run this expression, the 3 is no longer available.

Effectively what the expression does is this...

Cell001 = Left(Cell001,Index(Cell001,',') - 1)

PrashantSangle

Hi,

What is your expected output??

use & to concat to output

like

Cell001 = subfield(Cell001,',',1) & ' ' & subfield(Cell001,',',2)

It will give you output as G 3

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Data source has "G,3".   Cell needs to show...

cell.JPG

The first part is the contents of the cell.  The second part determines the background color

Subfield is nice but it doesn't work because it's replacing the contents of the cell and I lose the second part (the 3)

Not applicable
Author

Might not be the only solution but I had to break up the field during the load

Table1:

Load Table1Data,

SubField(col1,',',1) as col1,

SubField(col1,',',2) as col1bg

For the straight table

Add expression - col1

Col1 - Background color - Pick(col1bg,RGB(255,0,0),RGB(255,255,0),RGB(0,255,0),RGB(128,128,128))

Col1 - Text color - Pick(col1bg,White(),Black(),Black(),White())

Not the worst work-around.  Prefer QlikView expressions didn't work like reference base parameters