Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum $makelist WITH column names / maxc() WITHOUT column names

  • $makelist WITH column names / maxc() WITHOUT column names

    Posted by Uwe Smidt on December 21, 2023 at 9:35 am

    <div>Dear $all,</div>

    How do I get column names into a list created with $makelist, or get the maximum of a column with cmax() or $maximum()?

    Below is my useless code.

    Thanx in advance!

    Regards

    Uwe

    # Defining a list with Column names
    Do llFormObjectsOrig.$define(lcName,liLeft,liTop,liWidth,liHeight,liRight,liBottom)
    #getting a list of remoteform objects, but without column names
    Do $libs.MultiToolDB.$remoteforms.rfStartbildschirm.$objs.$makelist($ref.$name,$ref.$left,$ref.$top,$ref.$width,$ref.$height,$ref.$left+$ref.$width,$ref.$top+$ref.$height) Returns llFormObjectsOrig
    # $makelist overwrites Definition, no no column names
    # alternatively with $merge:
    Do llFormObjectsOrigDef.$define(lcName,liLeft,liTop,liWidth,liHeight,liRight,liBottom)
    # trying to get column names into list llFormObjectsOrig
    Do llFormObjectsOrig.$merge(llFormObjectsOrigDef)
    # Doesnt work, so try to get whatever the column name may be by:
    Calculate lcColName as llFormObjectsOrig.Col6.$name
    # is null
    # now the reason for needing column names: function maxc requires them!:
    Calculate liFormOldWidth as maxc(llFormObjectsOrig,llFormObjectsOrig.Col6.$name)
    # throws an error
    # alternatively, try this
    Calculate liFormOldWidth as llFormObjectsOrig.Col6.$maximum()
    # is null
    # time to ask the forum!

    • This discussion was modified 7 months, 1 week ago by  Uwe Smidt.
    Andreas Pfeiffer replied 7 months, 1 week ago 2 Members · 6 Replies
  • 6 Replies
  • Andreas Pfeiffer

    Administrator
    December 21, 2023 at 9:47 am

    Hi Uwe,

    You could use $appendlist rather $makelist. This does not destroy the definition.

    Do myList.$cols.$add(‘name’,kCharacter,kSimpleChar,255)

    Do myList.$cols.$add(‘description’,kCharacter,kSimpleChar,255)

    Do $classes.$appendlist(iMyClassList,$ref.$name,$ref.$desc)

    Note that the first parameter of $appendlist is the list where you want to put the result. If the list is not empty it will not delete its content but rather add the content at the end of the list.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    December 21, 2023 at 10:09 am

    .. alternatively you could use $redefine() to redefine the list. However personally I prefer $cols.$add because this does not require any additional variables for the definition.

    • Uwe Smidt

      Member
      December 21, 2023 at 11:42 am

      Thanx a lot Andreas!

      Both ways work fine!

      But why did this not work:

      # alternatively, try this
      Calculate liFormOldWidth as llFormObjectsOrig.Col6.$maximum()
      # is null

      • Andreas Pfeiffer

        Administrator
        December 21, 2023 at 1:11 pm

        What are you trying to achieve?

  • Uwe Smidt

    Member
    December 21, 2023 at 1:27 pm

    getting the maximum value of the the items in Col6 of the list

    (which I did get with with maxc(myList,myCol)).

    But I thought that myList.Col6.$maximum() would do the job without having a column name

  • Andreas Pfeiffer

    Administrator
    December 21, 2023 at 2:07 pm

    I see.

    $maximum is a property of a list column. So you could try something like this:

    listVar.$cols.myCol.$maximum()

Log in to reply.