Results 1 to 8 of 8

Thread: expression in relation

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    124

    expression in relation

    Is it possible to specify an expression in Parent Key property of Related Data?
    Name:  reverz_relation.jpg
Views: 103
Size:  69.3 KB
    The main object of the App is a table whose ID also contains the ID of a higher level data (left (child_id, 4) = parent_id). I would like to display higher level data in a section. What is the correct Lianja solution?

    It doesn't work the way I tried. Plus, a crazy thing happened. I tried to use Browse to look up the records in the "parent" table, but it seemed like all records were duplicates
    Name:  browse.png
Views: 100
Size:  52.5 KB
    ... everything was fine on the SQL server.
    Name:  mariadb.png
Views: 101
Size:  53.9 KB

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,460
    Hi Strato,

    Put the Parent key expression in brackets:

    Code:
    (left(lehivas,4))
    Are you seeing any errors reported in the Command Window or Console? If you LIST the table, rather than BROWSE are you still getting strange results?

    Regards,

    Yvonne

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Posts
    124
    hi Yvonne!
    the brackets had a magical effect: it works! Thank you!!
    I tried again without brackets. It doesn't work, but I couldn't reproduce the record duplication. There is an error message when closing and reopening the app: runtime error (498) field 'LEFT' not found. No other messages or errors reported in the Command Window or Console.

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,010
    Hi Strato,

    as in VFP and Lianjascript, putting an expression in brackets evaluates in place the expression contained.

    For example:

    lcTable = "my" + "table"
    use (lcTable)

    That's why the brackets are needed: the parent key attribute needs a string value.

    Hank

  5. #5
    Senior Member
    Join Date
    Oct 2012
    Posts
    124
    hi Hank,
    thank you for your help too. You really help me a lot! (I learn Lianja a little slowly ... but I try to be diligent)

    however, as for your example, it is true for VFP, not for Lianja
    In Lianja:

    lnTable = 1
    use (lnTable)

    but

    lcTable = "my" + "table"
    use & cTable

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

    Did you try it? Both ways it works in Lianja.

    Name:  Screen Shot 2020-10-31 at 8.14.40 AM.jpg
Views: 20
Size:  48.9 KB
    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
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,010
    Hi Stato,

    Yes, it is a rare instance when I don't test out something I think I know before I post. I've gotten to much "egg on my face", as the saying goes here, when I fail to check.

    Hank

  8. #8
    Senior Member
    Join Date
    Oct 2012
    Posts
    124
    don't worry about it ... the help I get from you and the others is more important

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