Validations in openbravo are meant to ease the user's interaction with the system. The most simple example would be, there are two tables c_country and c_region provided in the core module. Now at run time when an user chooses a country he would want the regions of that particular country to be displayed. this is achieved by validations. Validations can be applied to four basic data-types in openbravo.  They are Button, List, TableDir and the Table. Now to add a validation go the validation menu in the Application Dictionary-->Setup. Provide a new name under your module and add your logic in the Validation code column. There are 3 types of validations possible viz, SQL,Java and JavaScript. Lets do the SQL type. now to validate the region all you got to add is "c_region.c_country_id=@c_country_id@" . Now add this in column "c_region_id" in any table that you have used. Now for further insight, the "@" symbol is used to fetch the value of the variable. Now this option will be available only for few fields. To check whether the variable we need is in session or not go the "general setup->session variables" menu and check. If the variable is not there, there is a way to add it.
                           Go to tables and column and the go to the column whose value you might require at run-time. In the column tab, there will be a check-box called "Stored in session". tick that and your variable will be stored in the session and you can retrieve that using @variable_name@...happy working...:)
0

Add a comment

Popular Posts
Popular Posts
Blog Archive
Labels
Total Pageviews
Total Pageviews
148867
Subscribe
Subscribe
Labels
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.