Hello. I read about Visibility Conditions lesson, but I can solve this simple problem in my project. I have a user profile, and I want this user (X) to be able to follow another user (Y). I wish I could hide 'Follow' button (form with no fields) if X follows Y already, and display 'Unfollow' button instead.
Follow is a N to N relationship toward User entity, in my domain model. I managed to model this in the following way. I keep a variable numIsFollowing in my page, and I bound it to a query unit which outputs the number of records for witch follower.oid is X's oid and followee.oid is Y's oid (i.e. if X follows Y this returns 1 otherwise 0). So the variable numIsFollowing is 0 if X follow Y, 1 otherwise and I used an activation expression isFollowing that returns true if numIsFollowing variable is 1, otherwise it returns false, syntax is: "numIsFollowing == 1".
Then I set a visibility condition of my two buttons, follow and unfollow, by exploiting the truthfulness of isFollowing expression. The problem is that it doesn't work. It seems logic to me. The query works, the visibity contraints do, but they are not coherent with the database.
The idea of the model is the following (components are not connected, but it may help to figure out the model, assume verything is binded correctly). https://ibb.co/mDbk89W
My clue is that maybe it's wrong to set the value of a variable in the page and in the sam page hide a component with the result of that variable.