Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
rustyfishbones
Honored Contributor II

Replace Function for Color Variable

Hi All,

I have the following color Function

ARGB(255,100,100,150)

I want to replace the numbers with variables for a select in field.

I have a color variable called $(color.bars)

I have tried using the following

SUBFIELD(TextBetween($(color.bars),'(',')'),',',1)

which returns 255

but I want to replace 255 with a variable $(a.bar)

I have tried the following

=REPLACE(CHR(39)&TEXT(SUBFIELD(TextBetween($(color.bars),'(',')'),',',1))&CHR(39),'$(a.bar)')

but that does not work

Ant Ideas

Regards

Alan

6 Replies
mov
Esteemed Contributor III

Re: Replace Function for Color Variable

Alan,

My impression is that you want to achieve something simple using a rather complex steps.  If I got what you want (?), why don't you use

ARGB(VarName,100,100,150)

rustyfishbones
Honored Contributor II

Re: Replace Function for Color Variable

Hi Michael,

Yes you are correct, I have it working a more simple way, good spot.

But I was wondering if it could be done using replace

so I want to replace

ARGB(255,100,100,150) with

ARGB($(a),$(r),$(g),$(b))

it's more wanting to know if I can do it, rather than needing it right now!!

Regards

Alan

rustyfishbones
Honored Contributor II

Re: Replace Function for Color Variable

In my case

ARGB(255,100,100,150) is in a variable called $(color.bars)

Regards

Alan

rustyfishbones
Honored Contributor II

Re: Replace Function for Color Variable

this works, I think I was over thinking it

REPLACE($(color.bars),'$(color.bars)','ARGB($(a),$(r),$(g),$(b))')

mov
Esteemed Contributor III

Re: Replace Function for Color Variable

I still don't get it...    

If you want your function to be flexible, just use

ARGB(VarA, VarR, VarG, VarB)

And, define all these vars as any other variables, in input box, or in the script or in variable overview.  Function replace() is  a string function, and it makes sense in this content only if you load your argb() function from some source as a string:

LOAD

ColorFunction        // the value of this field is 'argb(255,100,100,150)'

FROM...

rustyfishbones
Honored Contributor II

Re: Replace Function for Color Variable

I'll try explain

I have a variable called $(color.bars), I have buttons that change the color of the bars, basically changing

$(a),$(r),$(g),$(b) variables


I have another variable called $(color.ribbon) which I have an option to change the bars to the same color as the ribbon, however the ribbon is ARGB(255,100,100,150) which means when I select to color of the bars to change to the same color as the ribbon, it changes the $(color.bars) variable from ARGB($(a),$(r),$(g),$(b)) to ARGB(255,100,100,150)

this means my other buttons will no longer works as they are changing the $(a),$(r),$(g),$(b) variables which don't exists

I wanted a quick way to change it back so my other buttons work.

I have it working now so..........

Thanks for your responses