Results 1 to 6 of 6

Thread: Mapping of VT column to Table column available?

  1. #1
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185

    Mapping of VT column to Table column available?

    Is there a function or other way I haven't found to determine the underlying field for a virtual table column?

    Since column captions can't be set, at least a builder could go through a section and move the captions over from the table.

    thanks,

    Hank

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Hank,

    You do all that using metadata.

    https://www.lianja.com/doc/index.php/MetaData_Editor

    set the formitem.caption for the column and it will push into the UI when the app is loaded. You don't need to do anything special.
    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

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    You also have many functions for working with metadata.

    databaseMetaData()

    tableMetaData()

    columnMetaData()

    You can attach metadata to database, tables and columns.

    metadata names are prefixed with database. table. and formitem.

    These are automatically applied in the UI as attributes when apps is loaded. They are global across all apps.

    so...

    formitem.caption=hello world

    will change all captions of fields in the UI that use a specific column when apps are loaded.

    You use the metadata editor to create and/or modify metadata for databases, tables or columns.

    You can also specify these using SQL in your own builders if required e.g:

    ALTER TABLE orders MODIFY COLUMN orderid METADATA "formitem.caption=hello world;backcolor=lightgreen;forecolor=blue;databack color=yellow;dataforecolor=red;'"

    This metadata is applied when apps are loaded. It is global across all apps. It can be conditional as described in the doc.

    I hope this helps to better understand how metadata works in Lianja.

    P.S. There are also meta types which are also covered in the doc. These provide sub-classing functionality.
    Last edited by barrymavin; 2018-11-03 at 02:32.
    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

  4. #4
    Senior Member
    Join Date
    Apr 2012
    Location
    United Kingdom
    Posts
    657
    Thanks Barry,

    That works really well and is just what I was looking for for VT columns.

    Just need to figure out now how to read it all from my Xcase model and get it entered automatically.

  5. #5
    Senior Member
    Join Date
    Apr 2012
    Location
    United Kingdom
    Posts
    657
    Hi Barry,

    I've done the meta data on the base table and that works fine. However when I use a VT bases on select * from danimal and then drop the fields from that onto the section they do not use the meta data from the base table.

    Do I need to do all the same meta data for the vt as well for this to work?

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Barry,

    What I am looking to do is to populate the metadata for a UI based on a Virtual Table from the underlying table attributes. From the developer perspective, a view has the fields I tell it to have: it's never a question. And I understand that from the data engine perspective, the fields can change at any time.

    In VFP, even the field order of the underlying table had to stay the same, as the mapping was set that way in the remote view DBC. That was a mess. Change the underlying field order and the DBC view had to be rebuilt. That really slowed down development.

    What I was asking, therefore, was is there a way to know the table.field on which a VT is based, that in turn based on the last time the VT ran of course. Almost every time I ask this kind of question I find out that yes, there is yet another aspect of the Lianja infrastructure which has been there for years but hasn't been exposed yet. I am no longer surprised. This information was known to the data engine when it ran the view the last time: is there a way to "get" that mapping information the engine knew at that moment?

    One Use Case would be to populate UI attributes for a VT based on the table attributes of an underlying Lianja table. Another Use Case would be mapping existing VT columns when reverse-engineering into an application that manages all aspects of attributes and metadata for an application: that's for when I get time, and tempus has been fugitting at the speed of light, it seems. But some day. I don't have any emergencies this weekend, so perhaps between doing dishes and laundry something will get done. I actually like doing normal things in life, like those things or fixing the lawn mower, etc., as a reminder that I don't just live in the tech world.

    Hank

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