How to block empty string in Database

26 Jan '12, 04:09 PM
61,196 Views
No Forum Badges

Hi,

I have a PostgreSQL database who contain some contraints like not null, greater than etc...

And when I use the Entry Unit and I let all empty fields, the insertion is possible because WebRatio replace the empty fields by empty string so the contraint not null are exceeded...

It's possible to avoid the empty string in the Entry Unit ?

Best regards.

Lionel


Ciao,

Ho una database PostgreSQL che ha qualche costrizioni come il not null, piu grande che, ecc...

Quando uso la Entry Unit e che lascio tutti i empty fields, l'inserimento e possibile perche WebRatio rimpiazza i empty fields con degli empty string, allora les costrizioni not null sono superati...

Sarebbe possibile impedire gli empty string nell'Entry Unit?

Grazie per la risposta.

Lionel

 
x 0
Follow
Answer Answer at this question and get points!
Forum Starter - Level 4

Hello Lionel, what I suggest you is to add Validation Rules on fields that must be mandatory. Then on the Create Unit you can set the property "Avoid blank records". If checked, the unit avoids the creation of blank records in the case all the provided inputs are Nulls or empty strings


Ciao Lionel, quello che ti suggerisco è innanzitutto di aggiungere le Validation Rules di tipo mandatory sui campi che si ritengono obbligatori. Quindi sulla Create Unit potrai impostare anche la proprietà "Avoid blank records", la quale, se selezionata, evita la creazione di record vuoti nel caso tutti gli input forniti siano nulli o stringhe vuote.

   
x 1
Forum Hero - Level 9

Hi,

when you enable the ""Avoid Blank Records"" Property you can define the Attributes that you want to verify by setting the Blank Attributes Property. This feature is performed by the Create Unit, in this case when the form is submitted and the Create Unit is running.

If you want to check the fields before the execution of the Create Unit, you can add the Validation Rules to the fileds. In this way you can validate the fields.

For example:

  • If a field is mandatory you have to add a Mandatory Validation Rule to this field.
  • If the value of a field must be greater than another value you can add a Compare Validation Rule.

For more details about the validation Rules you can refer to this article of our wiki: The Validation Rule Framework

 
x 1
No Forum Badges

Thanks for your response, if it's okey for you, I will write in english it's more easy for me :)

So, I tested the "Avoid Blank Records" property, and when I pressed the save button the first time, one blank record is inserted, but when I pressed the save button the second time, the error page is called and the insertion is blocked...

It's very strange... Now I will try with the "Validation Rules" but for the fields who doesn't have constraints what should I do !?

 
x 0
No Forum Badges

This solution works properly while creating, but how about updating?

For the update unit there's no "Avoid Blank Records".

When the field is not mandatory and the user leave it empty, the null field is replaced by an empty string, and contraints like "field not null" do not work as expected. 

 
x 0
No Forum Badges

I finally found a solution for the update unit!

I'm passing the field first to a "not empty unit" (with "empty string as null" checked) then to the update unit. The OK flow will pass the field with "not null values", and the KO flow will pass "NULL" to the update unit. The result in the DB is as expected, no empty strings!

 
x 0
Answer at this question and get points!

Related questions

502 proxy error-generate and run Adding and deleting from the database Agregar boton de cambio de contraseña en el login Alimentar graficas con base de datos Atributos Condicionales heredados Attribute comparison in a selector unit [beginner] - How to store and browse data collected with BPM app? 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 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? 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 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 DB in Data Service Project Deploy in Cloud Amazon Beanstalk with Postgres 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 Groovy and Database Guardar Saltos de LINEA Hide a form if condition if true 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 disble derby database? How to fix Network error(status 0) How to run web app with authentication service How to show certain values derived from relations in the domain model? 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 Mapping database of the entity '...' is unspecified [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 Problem accessing MySQL with WebRatio 6 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 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 Relaciones Removing the User-Group-Module tagles Retrieve a value and add some value to it reverse engineering, problema con le relazioni di default Script Unit e Mysql Share database connection Solve "Generation Error" with Generate and Run option Statistics Component for WebRatio > 7.2.0 Status ProcessInstance and activityInstance in spanish 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 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?! White report