Search code examples
openbravo

Display logic based on field's value length


Is it posible to create a display logic condition with the size or length of a field's value?

For example: @upc.length@<13 or anything like that?

I have tried it that way but it is not working. I would appreciate if anyone knows the logical operators for this. In the openbravo howtos is not very explanative.

Thanks.


Solution

  • As suggested in the comment, use an auxiliary input.

    Auxiliary Input

    Name : upcLength

    SQL

    select (case when length (upc) > 13 then 'Y' else 'N' end) as length 
    from  table where table_id = @table_id@
    

    In Windows, Tabs and Fields, for a field add the display logic.

    @upcLength@='Y'
    

    PS: Assumed DB Postgres.