335
Views
8
Comments
Solved
About switching enable and disable
Question
Application Type
Reactive

Hi, I am a beginner and I'm kind of still stuck...

This app is an event list. 
I want Enable column to be enabled (icon "ï¿¥") by default.

When I click "Enable/Disable" button, I want to change the icon of the Enable column, enabled (icon "¥") , disabled ( icon "×") .

I don't really understand the movement of this logic.
I can't switch after pressing once.

How should I set the switching logic?

I would appreciate it if you could tell me how to solve this.

Regards,
Zamiemon

EventList.oml
2023-10-21 19-42-11
Tousif Khan
Champion
Solution

Hello

You can create a Boolean variable to control the behavior of your widget Use the If Widget where you would like to display these icons
And according to Boolean
If true then show default icon
if false change the icon

  • And on the flow of your button you can simply write the logic to change the boolean value which will reflect the result

If you want to make it work like toggle
then jus use the assign statement as

example

  • Create local variable Boolean type default true,
  • ex: Show
  • Then on button click use a assign as
  • Show = not Show
  • Assign this on your button click flow
  • and same way use the Two icons and bind them in a if widget one in true branch another in false branch and set the condition as 
  • Show

This will work.

Please let me know if this helps

I have also attached the updated oml

Sample

Best Regards
Tousif Khan

EventList_Updated.oml
UserImage.jpg
Zamiemon U

Hi @Tousif Khan
 
I'm always grateful for your help.
That's settled. 
Thank you so much.

Regards,

2023-10-21 19-42-11
Tousif Khan
Champion

You are always welcome :)
I am Glad that I am able to help you.
Thanks,
Tousif Khan

2022-04-19 13-20-22
Andrea Lembo
Solution

Hi,

Replace the assign on the button click

BR,

AL

UserImage.jpg
Zamiemon U

Hi @Andrea Lembo 

I appreciate your help.

Best Regards,

Zamiemon


2024-09-17 18-14-33
Miguel Defavari da Silva
Solution

Hello,

Your logic is almost done, the only thing is that you created an assign that will always set the variable to true: 


You need something that always changes the variable to the other value (from true to false and from false to true).

My recommendation is:

This assign receives the current value and uses 'not' to change it.

Let me know if this works :)

UserImage.jpg
Zamiemon U

Hi @Miguel Defavari da Silva 

I appreciate your help.

Best Regards,
Zamiemon


2023-10-21 19-42-11
Tousif Khan
Champion
Solution

Hello

You can create a Boolean variable to control the behavior of your widget Use the If Widget where you would like to display these icons
And according to Boolean
If true then show default icon
if false change the icon

  • And on the flow of your button you can simply write the logic to change the boolean value which will reflect the result

If you want to make it work like toggle
then jus use the assign statement as

example

  • Create local variable Boolean type default true,
  • ex: Show
  • Then on button click use a assign as
  • Show = not Show
  • Assign this on your button click flow
  • and same way use the Two icons and bind them in a if widget one in true branch another in false branch and set the condition as 
  • Show

This will work.

Please let me know if this helps

I have also attached the updated oml

Sample

Best Regards
Tousif Khan

EventList_Updated.oml
UserImage.jpg
Zamiemon U

Hi @Tousif Khan
 
I'm always grateful for your help.
That's settled. 
Thank you so much.

Regards,

2023-10-21 19-42-11
Tousif Khan
Champion

You are always welcome :)
I am Glad that I am able to help you.
Thanks,
Tousif Khan

2022-04-19 13-20-22
Andrea Lembo
Solution

Hi,

Replace the assign on the button click

BR,

AL

UserImage.jpg
Zamiemon U

Hi @Andrea Lembo 

I appreciate your help.

Best Regards,

Zamiemon


2024-09-17 18-14-33
Miguel Defavari da Silva
Solution

Hello,

Your logic is almost done, the only thing is that you created an assign that will always set the variable to true: 


You need something that always changes the variable to the other value (from true to false and from false to true).

My recommendation is:

This assign receives the current value and uses 'not' to change it.

Let me know if this works :)

UserImage.jpg
Zamiemon U

Hi @Miguel Defavari da Silva 

I appreciate your help.

Best Regards,
Zamiemon


UserImage.jpg
Zamiemon U

Hi everyone.

I really appreciate your kind help!

I have little bit of trouble in my environment...

I'll let you know if this works well.

Best Regards,
Zamiemon

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.