Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Erlik
Contributor II
Contributor II

Filtering the string with background expression

Hello Experts,

I am an enthusiast without any programming experience or background, trying to make applications in my own way by applying the problems you have already solved in this forum. I would be very happy if you can help me with the following problem.

 

-----------

In the first section, you will find the data structure;

LOAD
Tarih as TarihFikstur,
"Kontrol Eden Hücre Lideri",
Hat,
Vardiya as vardiyafikstur,
"Boot Pozisyonlama Kontrolü",
"Tripod Çakma Kontrolü",
"Tripod Segman Koniği Kontrolü",
"FBJ Segman Koniği Kontrolü",
"Yaylı Şaft Merkezleme Üst Kontrolü",
"Yaylı Şaft Merkezleme Civata Kontrolü",
"Yaylı Şaft Merkezleme Dilleri Kontrolü",
"Segman Bogma Çenesi Kontrolü",
"Boot Tutucu Kontrolü",
"Segman Boğma Pimi"

 

-----------

My trials: Creating a sheet with button and using background expression. by filtering the Hat with 'Cell-5' string: 

So that if any data is NOK, than it will give red, if everything is fine, it will give green, if no data, then gray.

below image is the current one, which is not working;

Erlik_0-1707290241569.png

 

current defect background expression:   

=if(
wildmatch(Hat, 'Cell-5'),


if(
"Boot Pozisyonlama Kontrolü" = 'NOK'
or "Tripod Çakma Kontrolü" = 'NOK'
or "Tripod Segman Koniği Kontrolü" = 'NOK'
or "FBJ Segman Koniği Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Üst Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Civata Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Dilleri Kontrolü" = 'NOK'
or "Segman Bogma Çenesi Kontrolü" = 'NOK'
or "Boot Tutucu Kontrolü" = 'NOK'
or "Segman Boğma Pimi" = 'NOK',
lightred(),


if(
"Boot Pozisyonlama Kontrolü" = 'Uygun'
or "Tripod Çakma Kontrolü" = 'Uygun'
or "Tripod Segman Koniği Kontrolü" = 'Uygun'
or "FBJ Segman Koniği Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Üst Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Civata Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Dilleri Kontrolü" = 'Uygun'
or "Segman Bogma Çenesi Kontrolü" = 'Uygun'
or "Boot Tutucu Kontrolü" = 'Uygun'
or "Segman Boğma Pimi" = 'Uygun',
green(),


lightgray()
)
)
)

and finally Data values is below:

as you will find below, if you filter 06.02.2024, than it should give red, if you filter 05.02.2024, it should give green. But with my above expression, result is always blue (Above image).

Data values:

Erlik_1-1707290494015.png

Could you please do me a favor and support me?

 

Thank you and have a great day.

Erlik

Labels (1)
1 Solution

Accepted Solutions
Erlik
Contributor II
Contributor II
Author

@Anil_Babu_Samineni @vinieme12 

Thanks for huge efforts 🙂

 

Combination of both of your expression works perfectly.

 

=if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() ,

if( count({<FlagValue={'Uygun'},Hat={'Cell-5'}>}Flags) > 0, green(), lightgray()))

 

View solution in original post

8 Replies
Anil_Babu_Samineni

@Erlik You can try like this

=if(wildmatch(Hat, 'Cell-5') and ("Boot Pozisyonlama Kontrolü" = 'NOK'
or "Tripod Çakma Kontrolü" = 'NOK'
or "Tripod Segman Koniği Kontrolü" = 'NOK'
or "FBJ Segman Koniği Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Üst Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Civata Kontrolü" = 'NOK'
or "Yaylı Şaft Merkezleme Dilleri Kontrolü" = 'NOK'
or "Segman Bogma Çenesi Kontrolü" = 'NOK'
or "Boot Tutucu Kontrolü" = 'NOK'
or "Segman Boğma Pimi" = 'NOK'), lightred(),

if("Boot Pozisyonlama Kontrolü" = 'Uygun'
or "Tripod Çakma Kontrolü" = 'Uygun'
or "Tripod Segman Koniği Kontrolü" = 'Uygun'
or "FBJ Segman Koniği Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Üst Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Civata Kontrolü" = 'Uygun'
or "Yaylı Şaft Merkezleme Dilleri Kontrolü" = 'Uygun'
or "Segman Bogma Çenesi Kontrolü" = 'Uygun'
or "Boot Tutucu Kontrolü" = 'Uygun'
or "Segman Boğma Pimi" = 'Uygun',
green(),lightgray()))

 

If this is not working, Kindly share sample file to test with. 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
vinieme12
Champion III
Champion III

Things would be easier if you can transpose your dataset

 

CROSSTABLE(Flags,FlagValue,4)   //4 indicates first 4 columns will not be transposed

LOAD
Tarih as TarihFikstur,
"Kontrol Eden Hücre Lideri",
Hat,
Vardiya as vardiyafikstur,
"Boot Pozisyonlama Kontrolü",
"Tripod Çakma Kontrolü",
"Tripod Segman Koniği Kontrolü",
"FBJ Segman Koniği Kontrolü",
"Yaylı Şaft Merkezleme Üst Kontrolü",
"Yaylı Şaft Merkezleme Civata Kontrolü",
"Yaylı Şaft Merkezleme Dilleri Kontrolü",
"Segman Bogma Çenesi Kontrolü",
"Boot Tutucu Kontrolü",
"Segman Boğma Pimi"

From XyzSource;

 

then simply use below expression

= if( Wildmatch(Hat,'Cell-5') , if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() , green()) , lightgray() )

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Erlik
Contributor II
Contributor II
Author

Hello Anil,

 

Thanks for quick reply. I tried but couldn't achieve to work. It gives always green. 

I took all data struce from hub and created a new app. in qlik desktop. 

I hope, i managed to share it correctly. 

 

Thanks for huge effort 🙂

Erlik
Contributor II
Contributor II
Author

Hello Vinieme,

 

Thanks for quick reply.

I tried to do what you shared but couldn't achieve to work. I might set something wrong, therefore please check below ss

 

Erlik_0-1707303036732.png

 

expression

Erlik_1-1707303070023.png

 

Result on date of NOK was gray and on date of OK was again gray.

 

Erlik_2-1707303120020.png

 

Thank you 🙂

 

vinieme12
Champion III
Champion III

Use below background expression for each button

 

for cell-5 change to below and so forth for each button

if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() , green())

 

For cell-4

if( count({<FlagValue={'NOK'},Hat={'Cell-4'}>}Flags) > 0 , lightred() , green())

 

For cell-2

if( count({<FlagValue={'NOK'},Hat={'Cell-2'}>}Flags) > 0 , lightred() , green())

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Erlik
Contributor II
Contributor II
Author

Hello Vinieme,

 

It works perfectly,

 

Erlik_1-1707478850200.png

 

except 1 thins is missing, which is if no data, then it should give a gray colour. Is it possible to modify the expression like that?

I mean like:

 

if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() , green(), gray())

Anil_Babu_Samineni

@Erlik Perhaps this way for Lightgray()

if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() ,

if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) = 0, Lightgray(), green()))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Erlik
Contributor II
Contributor II
Author

@Anil_Babu_Samineni @vinieme12 

Thanks for huge efforts 🙂

 

Combination of both of your expression works perfectly.

 

=if( count({<FlagValue={'NOK'},Hat={'Cell-5'}>}Flags) > 0 , lightred() ,

if( count({<FlagValue={'Uygun'},Hat={'Cell-5'}>}Flags) > 0, green(), lightgray()))