Forums

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

Home Forum Omnis General Forum Smartlist is outsmarting me

  • Smartlist is outsmarting me

    Posted by Uwe Smidt on January 2, 2026 at 11:30 am

    Happy New Year to $all of you!

    A smartlisted list often gives me headaches! When it works, it’s a fantastic concept in Omnis, but when it doesn’t, I often find it hard to troubleshoot…

    In the code below (in table class ‘tanZaehlerstaende’), I iterate through all lines of tanZaehlerstaende in order to create aggregated new records in the same schema (distinguished by ‘ZS_RecordType’), using a local list ‘llAggregierteZaehlerstaende’.

    In the end, it all works fine, from 1.550 Meter readings I aggregate 747 aggregate records. When I try to commit with ‘Do <b style=”font-family: inherit; font-size: inherit;”>llAggregierteZaehlerstaende.$doinserts()’ (or $dowork()), NOTHING happens! No records are created in the database, no errors thrown. As if llAggregierteZaehlerstaende was not $smartlist or $definefromsqlclass. But it is!!!

    What is wrong here, and how can I troubleshoot?

    Best regards

    Uwe

    Uwe Smidt replied 2 days, 4 hours ago 2 Members · 8 Replies
  • 8 Replies
  • Andreas Pfeiffer

    Administrator
    January 2, 2026 at 11:51 am

    Hi Uwe,

    Happy New Year.

    You could override $doinsert (note – without the ‘s’) and see if you are able to track the error there. $doinserts calls $doinsert for every row where the $status is set to kRowInserted.

    Hope that helps.

    Best,

    Andreas

  • Uwe Smidt

    Member
    January 2, 2026 at 12:06 pm

    Hi Andreas,

    Happy New Year to you, too!

    My $doinsert is overridden in taSuper, but

    Do llAggregierteZaehlerstaende.$dowork()

    (or $doinserts) does not care to fire – it does not ‘catch’. When I step in, it just steps over.
    However, I’ve added some lines, merging llAggregierteZaehlerstaende into llZaehlerstaende, and now it works on ‘Do llZaehlerstaende.$dowork()’:

    Do llZaehlerstaende.$smartlist.$assign(kTrue)
    Do llZaehlerstaende.$merge(llAggregierteZaehlerstaende)
    Calculate lbSmart as llZaehlerstaende.$smartlist ## is it still smart(enough)? YES
    Do llZaehlerstaende.$includelines(kRowInserted) ## are there lines to be inserted? YES, all 747 lines
    Do llZaehlerstaende.$dowork()
  • Uwe Smidt

    Member
    January 2, 2026 at 12:09 pm

    So the main instance is $dowork’able, but the correctly created ‘sub’ instance llAggregierteZaehlerstaende is not.

    Is there an explanation for this behaviour?

  • Andreas Pfeiffer

    Administrator
    January 2, 2026 at 2:00 pm

    Uwe,

    If the method is not called I would think that there is no record where the status is kRowInserted. Check $status of an inserted row.

    Best,

    Andreas

  • Uwe Smidt

    Member
    January 2, 2026 at 5:28 pm

    Thanks for the hint:
    Calculate liStatus as llAggregierteZaehlerstaende.$history.1.$status ## Status is 8: kRowInserted
    So the first line has Status kRowInserted, and

    Do llAggregierteZaehlerstaende.$includelines(kRowInserted) ## are there lines to be inserted? YES, all 747 lines

    says that there are 747 lines to be inserted!

  • Uwe Smidt

    Member
    January 2, 2026 at 5:54 pm

    It seems like Omnis considers llAggregierteZaehlerstaende not to be ‘worth’ considering the $dowork-method, like it is not $smartlist, or not even defined from an SQL class.

    Is the a way the check the ‘status’ of a list, i.e. is it a SQL class-based list?

  • Uwe Smidt

    Member
    January 3, 2026 at 10:00 am

    Problem solved – still a bit of a mystery left…

    Problem was that I defined the list from a schema class:

    Do llAggregierteZaehlerstaende.$definefromsqlclass($schemas.tnZaehlerstaende) ## create a list based on the the same schema

    While the Documentation says

    You create a table instance in Omnis when you define a list or row variable from a schema, query, or table class, using the Define list from SQL class command, or the $definefromsqlclass() method.

    it appears that defining a list from a schema is good practice. However, reading on, there are subtle differences:

    Table instances created from a table class have all the default methods of the table class in addition to any custom methods you have added, perhaps to override the default methods.

    And yes, in my table super class taSuper, I have overridden all the default $dowork etc methods.

    So changing one line of code to

    Do llAggregierteZaehlerstaende.$definefromsqlclass($tables.tanZaehlerstaende) ## create a list based on the the same table class, NOT schema!!!

    did the job!

    Long live the small subtle differences in Omnis that make big differences!

  • Uwe Smidt

    Member
    January 3, 2026 at 10:04 am

    PS: I missed out on the mystery part:

    I have not tested if all would have worked fine when using a schema class for definition, with the default $dowork still in place.

Log in to reply.