Problems with letting a button disappear after a submit.

Hi guys,

For a schoolproject we have to create an application with outsystems. 

Now we are having some troubles with an If statement/button. Screenshots will follow.

The problem:

As a user I want to be able to join a project, so I subscribe by clicking on a button. After this submit I want te button to disapear. I still have the option to unsubscribe for the project. (If I do that the subcribe button should appear again). My fellow students and I created 4 users (for now). Now we have the application working as we want for 2 users. The button disapears for them when they subscribe and vice vera. For the 2 other users we cant seem to get it fixed, they still see the subscribe button while they are already subscribed to the project. We tried many things with the if statement and other places but we never got it working for all users. Can someone lead us in the right direction?

User 1 (doesn't work):


As u can see it still shows "Join".


User 2 (works fine):


No Join button because the user has joined already. (after removing registration it will appear again)


User 3 (works fine):


No Join button because the user has joined already. (after removing registration it will appear again)


User 4 "Marco" (Same problem as user one) 


How can we make this work for every user we create? We just don't understand why the different people don't work the same. 


Thanks in advance!

Hey Robbin,

That does seem strange, would you mind sharing the details of the If condition(s) around the button?

Thank you

Hi Robbin,

Which condition you are using to show or not show the button? 

Regards,

Marcelo

Ofcourse:

So if the statement is true it shouldn't show.

if statement is false, then it should show the "join"


Hi Robbin,

If you use a List.Current you only compare with 1 element of the list.In preparation you need to add some code to compare the GetUserId() with all the elements of the list. And use the result of that check in this if. when you click the join you should run this check again. Also you don't need to check if IdeiaId since to get this list you already did a query filtering by IdeiaId correct?

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Robbin,

If you use a List.Current you only compare with 1 element of the list.In preparation you need to add some code to compare the GetUserId() with all the elements of the list. And use the result of that check in this if. when you click the join you should run this check again. Also you don't need to check if IdeiaId since to get this list you already did a query filtering by IdeiaId correct?

Regards,

Marcelo

Can you eplain where we have to put the extra code to compare with GetUserID()? The filtering with de ideaid is needed.

Hi Robbin,

In preparation you can have a loop with the list that have everything that join with a if checking if the GetUserId() is there if it is assing a boolean like IsAlreadyFollowing to true. Than use that boolean to show or not the button. You will also need to change this boolean when the user click join.

Regards,

Marcelo

Hi Marcelo,


You gave me an idea how to fix it, Maybe it isn't the cleanest way to get things done, but it is working.
Made an other aggerate and a Boolean field in the database. I used that aggregate to make an if statement, within that if statement I looked if the Boolean was false or true. When it was false it showed the join button and if it was true then the button disappears. 


Hi Robbin,

Glad I could help. your solution is not has clean because you are doing an extra aggregate but the important is that is working. In the future when you start knowing the platform better you will improve everything for sure.

Regards,

Marcelo