Forums

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

Home Forum Omnis General Forum Show subformdialog command parameters

  • Show subformdialog command parameters

    Posted by Obonye on November 21, 2024 at 9:48 pm

    I have this command in the client-method in a remote form that opens a subform: /*

    Do $cinst.$clientcommand(“subformdialogshow”,row(‘jsDialogSelectFieldSearchResult’,’jsMyRemoteForm’,stgettext(‘search_result’),$cwind.$width*0.7,$cwind.$height*0.7))

    */

    If I run this command, it returns a databridge socket error. The documentation says the row() contains: classname, params etc. How do I pass a parameter in the row in a client method? and can I pass a parameter with multiple strings in it?

    Regards, Martin.

    Andreas Pfeiffer replied 8 months, 1 week ago 2 Members · 5 Replies
  • 5 Replies
  • Andreas Pfeiffer

    Administrator
    November 22, 2024 at 8:24 am

    Hi Martin,

    Try the following:

    Calculate lParam as con(kSq,’jsMyRemoteForm’,kSq)

    Do $cinst.$clientcommand(“subformdialogshow”,row(‘jsDialogSelectFieldSearchResult’,lParam,stgettext(‘search_result’),$cwind.$width*0.7,$cwind.$height*0.7))

    The parameter that you want to pass needs to be in quotes.

    Btw. from within your dialog form, i.e. from its $construct you can always use $cinst.$container() to reference the calling form. For example if you need a value, you can create a public method in the calling form, i.e. $getIdent, and then from the $construct of the subform you can use this to ask for the ID like this:

    Do $cinst.$container().$getIdent() Returns lIDent

    I hope this helps.

    Best,

    Andreas

    • Obonye

      Member
      November 22, 2024 at 10:31 am

      Hi Andreas,

      Sure. It helps.

      Just curious to know what is the advantage of calling the container methods from the subform over passing a parameter from the main form on to the subform? And/or vice versa.

      Regards,

      Martin.

    • Obonye

      Member
      November 22, 2024 at 11:27 am

      After implementing the quotes, now I get a javascript error message as shown below:

      Calculate lCalcSeparators as $root.$prefs.$separators()

      Calculate lSeparators as mid(lCalcSeparators,3,1) ## function parameter separator

      Calculate lParam as con(kSq,’jsMyRemoteForm’,kSq)

      Do $cinst.$clientcommand(“subformdialogshow”,row(‘jsDialogSelectFieldSearchResult’,lParam,stgettext(‘search_result’),$cwind.$width*0.7,$cwind.$height*0.7))

      • This reply was modified 8 months, 1 week ago by  Obonye Mato.
  • Andreas Pfeiffer

    Administrator
    November 22, 2024 at 12:28 pm

    Martin,

    I made you a small sample library (attached). It can also be opened using the Community Edition of Omnis Studio 11.1

    Of course you can use a parameter to send information into the dialog form. However it becomes complicated if you want to re-load the detail form if something changes in the calling form. Ok – in that instance that cannot happen because the dialog form is modal.

    But as soon as it gets a little bit more complicated – for example you want to send an entire row, it is much easier using an API. Also you cannot send any binary data (i.e. pictures). They would need to be converted into base64. However this is possible when sending messages.

    I implemented a small API into the jsTest form that returns the entire row of the data list as well as in the other direction. That way you can also send information back to your calling form easily.

    So when the user presses the “save” button in the dialog form it sends back the entire row into the container. You can see that when you change the street in the dialog and press the button.

    For implementing a proper API you will soon realise that you always need the same methods, i.e. $getIdent, $setIdent etc. It might be clever to have a superclass which actually has those methods in place. That way every inherited class will have them already.

    The example also shows how to pass the parameter properly. It shows it as a title above the fields.

    I hope that makes sense.

    Best,

    Andreas

    • Andreas Pfeiffer

      Administrator
      November 26, 2024 at 1:44 pm

      Hi Martin,

      I added two buttons in the detail form that allow to step forward or backwards through the list. With those buttons you can see how messaging can actually perform between the dialog form and the underlying container. It not only steps through the records it also disables the previous button if there is no previous record or disables the next button if it already shows the last record of the list.

      Have fun!

      Best regards,

      Andreas

Log in to reply.