Skip to main content
MattSmart
Employee

A review of a problem I had with varaibles that continued to revert to their previous values.

A definition for insanity is doing the same thing over and over expecting a different outcome. In this blog, I hope to save you, the reader, from going through what I went through, maybe five minutes of reading, will save you from the hours of confusion that I had to endure.

Background: In case you don’t know me, I’m Matt Smart. I work on the demo team here at Qlik. I am currently in the process of updating some Qlik Sense apps. This can involve updating extensions that may not work properly, correcting expressions that are no longer functioning, or more cosmetic, such as refreshing the color schemes of an app. The latter is where my problem began.

Situation: While updating an app titled ‘Overall Equipment Efficiency’, I wanted to change the color scheme of a sheet titled “Shift OEE”. This sheet used a burnt orange and gray color scheme to designate the differences between a ‘Morning’ and ‘Evening’ metric.

MattSmart_0-1677875498172.png

 

I wanted to change the colors, so I navigated to the properties panel and selected Appearance > Colors and Legend where I found the following expression: if(ShiftType='Afternoon', $(vAfternoonColour), $(vMorningColour)) . Great, the colors are controlled by an expression, this expression says “If the shift type is Afternoon, use the vAfternoonColour, otherwise, use vMorningColour. The ‘v’ in front of these parameters tells me that they are variables. Awesome, all I have to do is change the values of these variables, and I can change the colors to the new colors.

So I venture to ‘Variables’ at the bottom left-hand part of the ‘Edit sheet’ page.

MattSmart_1-1677875498193.png

 

Within the list, I find the variables contained in the color expression, along with their definitions, RGB values to designate the colors attached to them.

MattSmart_2-1677875498215.png

 

Now all I have to do is change these values to whatever colors I want, and I am done. I go to edit, change the values and BAM! My colors are updated, and the app is looking good.

MattSmart_3-1677875498450.png

 

After being away from my computer for a bit, I return to resume editing the app and what do I find? The colors reverted back to their original values.

MattSmart_4-1677875498643.png

 

Maybe my changes didn’t save. No problem, I’ll just fix it again and continue working.

The next morning, I get on my computer again, load everything up and:

MattSmart_5-1677875498834.png

 

Burnt orange and gray. Something is wrong. The other changes I made are still in place so it cannot be an issue in saving. I go back to variables and change the values back to Purple and Blue. “I’ll test it out.” I say to myself, completely exiting out of my browser and signing back into my tenant.

MattSmart_6-1677875499072.png

 

Finally. It saved. I can move on, and I do. Continuing to work on the app again until lunch time. A full belly later, and I reopen my tenant and:

MattSmart_7-1677875499289.png

 

“Witchcraft.” I mutter to myself. Why is this happening? There must be something I am missing. Why is it only this value that continues to revert? I ponder on it, changing it back, worried that the next time I open my tenant, I’ll see burnt orange and gray yet again. The next morning, orange and gray. What is happening?

The Solution: It is important to remember that here at Qlik, we’re all one big team, and I am lucky to be a part of an amazing subsection of this team, the Demo Team. I bring up my problem in the morning meeting, expressing that I am dumbfounded. I have tried everything that I can think of. When I am told, “Did you check the Data load editor”.  I hadn’t. Sure enough, in the script for this app, we’d find colors and:

MattSmart_8-1677875499344.png

 

vMorningColour and vAfternoonColour. I change the values here and:

MattSmart_9-1677875499583.png

 

I eat lunch, I load up and:

MattSmart_10-1677875499821.png

 

Finally, success.

What was happening: What confused me originally was the time of the changes. It seemed to only happen after a certain amount of time had passed. This should have been my first clue. While I was changing the values in the variables section, these values would only stay for a certain period, that period being a data load. When the data would load again, my values would be rewritten and thus my bars would return to their former color. To put it simply: the data load trumped my edit in the variable section. That’s why it would only happen after a certain amount of time. It wasn’t a saving issue at all.

 

Conclusions: There is always a logical reason behind why something is happening. When you run into a problem, begin looking for a solution in a different place. My problem was I thought I knew what was happening, and I repeatedly tried the same solution hoping it would stick instead of investigating further. Additionally, different points of view can lead to different solutions.

Hopefully my pain can be a lesson to you, and this can help you on your Qlik journey.

PS: Don’t forget to check your Data load editor.