Forums

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

Home Forum Omnis General Forum scope variable

  • scope variable

    Posted by Coralie on April 17, 2019 at 2:41 pm

    Hi everyone,
    I’m using Omnis 8 and Js Forms.
    I have an iVar in the first form and I need its value in the second form. How can I change the scope of my var so that I can access it?
    Regards,
    Coralie.

    Coralie replied 5 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Klaus Schrödl

    Administrator
    April 17, 2019 at 3:28 pm

    Hi,
    the easiest way would be to make the variable a task var, so it’s “visible” in the whole application. But that’s not a good or elegant approach.
    The better way would be to create a public method (starting with the $) in the second form, to make it accessible from outside, i.e. $setmyvalue with a parameter of the required type. And then call it from the first form
    Do $iwindows.InstanceNameOfSecondForm.$setmyvalue(iVarFromFirstForm)
    Hope that helps
    Klaus

  • Coralie

    Member
    April 17, 2019 at 4:28 pm

    Hi Klaus,
    I had tried the task type variable but it didn’t work (I don’t how I failed that…). But your solution went great.
    Thank you very much once again Klaus,
    Regards,
    Coralie.

Log in to reply.