Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Syntax for referencing another column in the table

  1. #1
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    485

    Syntax for referencing another column in the table

    In the metedata editor for a table I have two fields

    cMicrochip
    cfk_dmicrochipreader

    I only want cfk_dmicrochipreader to be enabled if cmicrochip is not empty

    I have entered in the metadate entry

    formitem.enabled
    empty(cmicrochip)
    F

    and another entry
    formitem.enabled
    !empty(cmicrochip)
    T

    This does not however seem to work in the section where the field is. I can only assume I have the syntax wrong.

    Please can someone tell me how this should look.

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Quote Originally Posted by avianmanagement View Post
    In the metedata editor for a table I have two fields

    cMicrochip
    cfk_dmicrochipreader

    I only want cfk_dmicrochipreader to be enabled if cmicrochip is not empty

    I have entered in the metadate entry

    formitem.enabled
    empty(cmicrochip)
    F

    and another entry
    formitem.enabled
    !empty(cmicrochip)
    T

    This does not however seem to work in the section where the field is. I can only assume I have the syntax wrong.

    Please can someone tell me how this should look.
    Reading the metadata doc you use conditional metadata.

    formitem.enabled[empty(..)]

    You put an OData encoded expression inside the [ ].

    OData expressions donít use standard operators such as = you use eq ne etc

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Quote Originally Posted by barrymavin View Post
    Reading the metadata doc you use conditional metadata.

    formitem.enabled[empty(..)]

    You put an OData encoded expression inside the [ ].

    OData expressions donít use standard operators such as = you use eq ne etc
    Use true and false not F and T also

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Quote Originally Posted by barrymavin View Post
    Use true and false not F and T also
    And to answer you other query. The metadata keys can be anything. formitem. is a special prefix that causes that metadata to be applied to a formitem for that column name.

    You can have custom keys such as David.xxx which is custom metadata. You can process these at load time to do clever things.

    So as you can see there is a lot that can be done with metadata.

    First thing is to sit down and think. Too many developers skip this functionality and opt to code when they donít need to.

    Bear in mind though. Metadata is for apps as the data dictionary is to the database engine I.e validation in the DD is active in Lianja database engine including Lianja SQL server.
    Last edited by barrymavin; 2018-11-03 at 06:06.

  5. #5
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    485
    Hi Barry,

    I still can't get this to work

    In the metadata editor for the column I have:

    Attribute formitem.enabled
    condition [empty(cmicrochip) eq true]
    value false,true

    On the section it is enabled no matter what the value of cmicrochip is

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Hi David,

    the […] syntax is when you are setting the metadata yourself using ALTER TABLE. If you are using text metadata editor you can omit the [ and ] from the condition.

    Also, you don’t need the “eq true” as empty() is a logical condition itself.
    Last edited by barrymavin; 2018-11-03 at 08:55.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    485
    OK so now I have in the metadata editor

    Attribute formitem.enabled
    condition empty(cmicrochip)
    value false,true

    it still does not work

  8. #8
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    485
    Looking at this more the obvious way to do it is in code with alter table commands as it's then all in a prg and make it more robust and quicker to implement

  9. #9
    Senior Member
    Join Date
    Apr 2012
    Location
    Dubai, United Arab Emirates
    Posts
    485
    Doing this using alter table sets the values in the metatable fine.

    However when setting lets say the caption property for it to reflect in the section it needs to be formitem.cpation rather than caption.

    Once again am I doing this in the wrong metadate table, or am I missing something here?

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    5,771
    Quote Originally Posted by avianmanagement View Post
    OK so now I have in the metadata editor

    Attribute formitem.enabled
    condition empty(cmicrochip)
    value false,true

    it still does not work
    Enabled and visible are only applied in runtime mode not development mode.

    Click into desktop app view (runtime mode).

    Also... Just to refresh your memory. The "App Inspector" is your friend.

    Double click the "Events" tab and it all float in its own window. You can then see what metadata is being applied as it is logged.

    Name:  Screen Shot 2018-11-04 at 9.42.11 AM.jpg
Views: 50
Size:  89.5 KB

    Metadata is applied whenever a UI element is refreshed. So conditional metadata can be used to handle context sensitive operations.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Page 1 of 3 123 LastLast

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us