Hide a form if condition if true

21 Jul '19, 09:58 PM
5,541 Views
No Forum Badges

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. 

 
x 0
Follow
Answer Answer at this question and get points!
Forum Hero - Level 9

Hi Matteo,

first of all you can try to see if the Expression evaluates the content of your Variable as you expect. You can add a println to your expression code to print the Variable and see the result in Tomcat console.

For example your Variable could contains an array or a list instead of a scalar value and in this case your conditional expression is not valid for desired comparison.

Moreover you could use boolean Variable and boolean values.

I hope this will help you.

 

 

 
x 0
Answer at this question and get points!

Related questions

502 proxy error-generate and run Adding and deleting from the database Add select all to Checkable List Agregar boton de cambio de contraseña en el login Alimentar graficas con base de datos API documentation? Atributos Condicionales heredados Attribute comparison in a selector unit [beginner] - How to store and browse data collected with BPM app? Browser integration in enterprise project Business object data Cancellare campi e tabelle dal database Cannot add a Database in the Domain Model Cannot connect to MySQL Cannot insert an entity in the database Cannot invoke method selectSingleNode() on null object Can't generate and run database or start tomcat server! Change uplod directory and protect anauthorized access to files ckeditor - change directory for the browser Como hacer un menu en webratio? Como mostrar una imagen en una lista o en la componente detalles? Como recuperar todos los atributos de una relacion N:N y insertar registros? com.webratio.struts.exceptions.WRSecurityException: Invalid request target host Conexion a Oracle 12g Connection refused. connect to Cloud Convert data in a Calculated attribute Convert selector component result to single value Creación DB Apache Derby - Modelado BPMN Create sub-processes in WebRatio 8.5.2. Criptare dati sensibili nel database Database connection, Host and Port number Database password encrypting Database properties Database resource consumption Database Tables Creation After Remote Deploy Data flow from a page which is not visible anymore DB in Data Service Project Deploy in Cloud Amazon Beanstalk with Postgres Derivation in a Entity Dynamic data type Empty record mistakenly saved Error updating metadata process EverLasting error "The TCP/IP connection to the host has failed. Connection refused" Execute truncate sql query file analysis then update MySQL database Find Model Problemas Foriegn key relationship Generate and run locally on webratio professional edition. getting data from database Getting the absolute path of a RTXBLOBData Groovy and Database Guardar Saltos de LINEA How can I import a view in the Domain Model as an attribute of an Entity? How database or datamodel migration? How I can receive the primary key value after adding into database from OK Port. How to block empty string in Database How to disble derby database? How to fix Network error(status 0) How to implement a BPMN Service Task into WebModel How to redirect to the correct site view after a successful login attempt How to show certain values derived from relations in the domain model? How to use GoogleGeocoding Add-on I can't run any application with WebRatio (Table/View 'APP.POST' does not exist) Image in List field Insert data into database Is it possible to create a derived relationship between databases? JDBC4 Postgresql Driver JDBC connection with mysql on mac Job not start correctly Login Error Mapping database of the entity '...' is unspecified Missing plugin emulation support error [MOBILE] Can't synchronize domain model with beck end DB Mostrar datos de diferentes tablas/ show dates from diferentes entities MS SQL server jdbc file multi selections field problem MySQL Driver jdbc No Apache Derby driver found No Database on Cloud account No database on my cloud account Passing JSON Object to Model Personalizzare lo stile di un progetto PostgreSQL Predefined values in database Primefaces Problema al generar y ejecutar proyecto Problem accessing MySQL with WebRatio 6 problema con la apertura del navegador Problema Grafo da una lista gerarchica Problema ¨HTTP Status 404" Problemas con el Operations View Delete Problem saving multi selection from input Problems to connect Sql Server DB from Webratio Problems with Database Metadata Problem with application runnung Problem with fields with accents used in attribute condition Problem with query unit! Problem with stored procedure Problem with the deletion of more than 50.000 records in a table publish web service for storing information in PostgreSQL DB following XSD Resource query a database Refresh and Synchronize DB Problems Regla de negocio para que no permita repetirse un campo Relaciones Removing the User-Group-Module tagles Responsive Bootstrap Grid Retrieve a value and add some value to it reverse engineering, problema con le relazioni di default Script Unit e Mysql Search by Selector component does not work Share database connection Solve "Generation Error" with Generate and Run option Statistics Component for WebRatio > 7.2.0 Status ProcessInstance and activityInstance in spanish Switch Unit on Mobile Platform Community Sybase JConnect 4 JAR replace Sync DataService Project with Mobile Project Table 'freeapp43.profesion' doesn't exist Tarea de servicio no me evalua el valor Trying to Synchronize Domain Model Unable to execute the script java.lang.NullPointerException Unknow property on Dynaclass after generation Unspecified BPM Engine Database Update mutiple records with the same value upload file and the move it to other location User Login Timestamp Username come chiave Using own User and Group tables Vista de diferentes Site Views Webratio Add-ons no permite login WebRatio Browser Integration (Mozilla) Not Supported Web ratio data model WebRatio - list results of joined tables Web Ratio Mobile and Foreign Key Web Ratio Mobile - Remote data mapping problem WebRatio no imports all attributes (fields) of a table Where is the ACME demo data stored?! which of these three models is closer to webratio/ifml way of creating web applications White report