Forums

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

Home Forum Omnis General Forum $cinst variables deletion

  • $cinst variables deletion

    Posted by Obonye on July 21, 2024 at 12:08 pm

    Hi @all,

    Has anyone found a way of preventing deletion of instance variables especially those that have not been used in any method? I have variables that are calculations in their definitions. But Omnis still allows these types of variables to be deleted.

    Martin.

    Andreas Pfeiffer replied 1 year ago 2 Members · 3 Replies
  • 3 Replies
  • Andreas Pfeiffer

    Administrator
    July 21, 2024 at 2:03 pm

    Hi Martin,

    Do not prefix an instance variable with „$cinst“. Than it should be save to use the command to remove unused variables.

    Best,

    Andreas

  • Obonye

    Member
    July 24, 2024 at 7:45 am

    Hi Andreas,

    Thank you for your reply. I have changed how I reference instances to align with your guide. Though I learnt this technique from your sample library where you prefix instances with “$cinst.” in the table classes to reference the rows in the window instance.

    Kind regards,

    Martin.

    • Andreas Pfeiffer

      Administrator
      July 24, 2024 at 8:04 am

      Martin,

      Yes – when your code is inside the table class you can refer to that same instance using $cinst. For example: $cinst.name refers to the name column of your row or list variable if your code is inside that table class.

      But when you want to refer to the instance variable outside of that table class, i.e. from within the form, I would recommend not to prefix the instance variable. For example:

      $cinst.iDataRow.name ## would certainly refer to the name column within iDataRow but you lose the tokenisation of that variable. It is better to omit $cinst for this matter.

      The same is true for task variables. Some people prefix a task variable with $ctask which is also not a good idea for the same reason.

      Hope this explanation helps.

      Best,

      Andreas

Log in to reply.