Attribute comparison in a selector unit

18 Feb '14, 08:13 AM
86,322 Views
Forum Forum Starter - Level 3

Hi,

I need to define a condition comparing two attributes, such as in a Person table find all people living where they were born.

Suppose a have a table T with two attributes A and B: how can I retrieve records having A=B in a Selector Unit (or A>B, ....)?

Tks!

 

 
x 1
Follow
Answer Answer at this question and get points!
Forum Expert - Level 5

In your example your date is like this:

ID | A | B

01 | 1 | 1

02 | 3 | 2

03 | 2 | 2

04 | 4 | 5

 

And you can get A = B, you need get the row 01, 03?

 

 
x 1
Forum Starter - Level 3

Hi Pablo,

yes I have to retrieve rows 01 and 03. I don't know how to achieve this modeling conditions in a selector unit. It's trivial in SQL: select * from table where field1 = field2.

I usually adopt a partial solution: model a calculated derived attribute C as A-B, and add a condition C = 0 at the selector unit.

However, it works fine with some data types such as integers, but it does not work fine with strings. Besides, the result is not a clear and undestandable model.

 
x 0
No Forum Badges

Hi, in this case it's better if you use the Query Component, in this way you can write a SQL or HQL query as you want.
More details at: http://www.webratio.com/learn/article/Getting-started-with-the-Query-Unit

 
x 0
Forum Expert - Level 5

The main drawback in the sql component is that you can not pass the results to another component. 
You can do the following: 
Perform the query using a script component whith your query
http://www.webratio.com/learn/article/Querying-with-Hibernate 

Or easier, create a calculated derivation that will generate a view, obtaining the oid when the fields are equal, where Self.oid self.a = Self.B. Of which you are going out alone the oid in which the two fields are equal, regardless of what type they are. 

Slds

 
x 0
No Forum Badges

Actually the Query Component has the output parameters, you have to create one parameter for each element present in the select condition

 
x 0
Forum Expert - Level 5

Other option is create an inmemory table and load data format to use with an normal selector. You need previously transform your data.

 
x 0
Forum Expert - Level 5

Actually the Query Component have a output parameter, but only you pass one result.

For example, I consulted the user table, but I want to get all the resulting oid, 1,2,3,4,5 .... in the link. The result is only one oid, corresponding to the record.

 

 

 
x 0
Answer at this question and get points!

Related questions

502 proxy error-generate and run Acceder a diferentes site views/ Acces to diferents site views Adding and deleting from the database Add to Bag link in ACME Agregar boton de cambio de contraseña en el login Alimentar graficas con base de datos any webratio book ? Asking For a Book Atributos Condicionales heredados [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 Clarification about the NoOperation unit Codigo QR 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? Conditional Expression "greater than 0" on null fields Conexion a Oracle 12g Connection refused. Connect more query unit connect to Cloud Content module page variable won't assign. Convert data in a Calculated attribute Convert selector component result to single value coupled mandatory fields Creación DB Apache Derby - Modelado BPMN Create Unit with Date (Year only) Criptare dati sensibili nel database Custom Attributes Condition Database Database connection, Host and Port number Database List is not showing up in App Emulator Database password encrypting Database properties Database resource consumption Database Tables Creation After Remote Deploy Data is always created doubled Data Management: Updating Data - Attachments - Updating Data Sample Project Final DB in Data Service Project Deploy in Cloud Amazon Beanstalk with Postgres Description: Unknown tag 'wr:LinkResource' Dudas sobre modelado(Data Flow,Forms y Operation Create) Dynamic data type Empty record mistakenly saved en_US codify problem Error updating metadata process EverLasting error "The TCP/IP connection to the host has failed. Connection refused" Execute truncate sql query Export XML external link.= file analysis then update MySQL database Filter information in a Simple List Find Model Problemas Foriegn key relationship Format currency forward/backward navigation and bookmark in ajax web app Generate and run locally on webratio professional edition. "Generation Error" with Generate and Run Generation options problem get the attachment files of an email getting data from database Get Unit problem Get Year from Date Groovy and Database Guardar Saltos de LINEA Help for connect public and private site views Hide a form if condition if true How can i create pagemenu or landmarkmenu with multiple levels. How can I import a view in the Domain Model as an attribute of an Entity? How database or datamodel migration? How does WebRatio represent these IFML elements? / ¿Cómo representa WebRatio estos elementos IFML? How I can receive the primary key value after adding into database from OK Port. How i can reuse modules in multiple projects? How to block empty string in Database How to define the sequence of execution units on a page? How to disble derby database? How to display the attributes of a related entity. How to filter imported attributes? How to fix Network error(status 0) How to include Selector Unit result in Mail Unit Body? How to pass vars to a alternative page How to process IFML Model (build with Eclipse editor) with ATL How to run web app with authentication service How to show a page based on a boolean? How to show certain values derived from relations in the domain model? How to speed up the "last" link using PowerIndexUnit for lots of records How to store data related to an entity in relationships in a project web I can't run any application with WebRatio (Table/View 'APP.POST' does not exist) Image in List field Insert data into database Insert master page to many hybrid modules Integrating a BPM model into an existent WebML model Is it possible to create a derived relationship between databases? JDBC4 Postgresql Driver JDBC connection with mysql on mac Job not start correctly JSON I/O Unit e informazioni derivate KO Links in Selector Unit Landmark in hybrid module Link localization Links from Index unit with condition Link Visibility Condition Power Index Unit Mail multipla maintain the record order in a sortable list Mapping database of the entity '...' is unspecified Math Unit to update attributes of an entity? [MOBILE] Can't synchronize domain model with beck end DB [MOBILE] How I extract information from JSON client side? Modifica Entità tramite file xml Mostrar datos de diferentes tablas/ show dates from diferentes entities MS SQL server jdbc file Multi Entry Unit: How to forward only checked rows? multi-lingual product description multi selections field problem MySQL Driver jdbc No Apache Derby driver found No Database on Cloud account No database on my cloud account Non riesco a fare funzionare Xml out unit Parametrizzazione Selector Unit 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 Example create Unit (no company in employee table) Problem in adding diagrams in IFML Editor (Eclipse) 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 Scroller 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 Question about Site Views Refresh and Synchronize DB Problems Relaciones Removing the User-Group-Module tagles Rename passing attributes Replace ID by its value in another table 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 Select between parameters Selector unit doesn't return any value in hybrid module Sending mails is not working Sending mails with gmail is not working Setting the Default link for a Switch unit Share database connection show/hide fields on button click (registration page) [solved] all links transparent, why ? Solve "Generation Error" with Generate and Run option Something leads to wrong condition expression evaluation. Statistics Component for WebRatio > 7.2.0 Status ProcessInstance and activityInstance in spanish sumar atributos de una tabla filtrado por Role Condition Sum entity's values 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 Transportation Link issue Trying to Synchronize Domain Model Unable to execute the script java.lang.NullPointerException Unique Fields 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 using relationship role conditional with null usuarios y grupos utilizzo componenti database Visibility Condition on Multiple Links From Index Unit Web ratio data model WebRatio - list results of joined tables Web Ratio Mobile and Foreign Key Web Ratio Mobile - Remote data mapping problem WebRation - Create Navigation diagram WebRatio no imports all attributes (fields) of a table Where is the ACME demo data stored?! White report