Forum Replies Created

Page 4 of 21
  • Andreas Pfeiffer

    Administrator
    December 13, 2024 at 12:33 pm in reply to: Dialogform container messaging

    Martin,

    Yes – you can have as many methods you want in your table class and I would recommend that most of the methods supposed to be written in an abstract way and sit in the super table class. That way you would be able to re-use them for all of your lists and rows. Remember the list or row is the instance of a table class.

    Attached please find your library modified so that it uses the table class. There is a method $hasduplicates that can be used to proof if there are any duplicates and also there is a method that shows the duplicate values.

    Note I was using Omnis Studio 11.1.

    Best, Andreas

  • Andreas Pfeiffer

    Administrator
    December 13, 2024 at 9:17 am in reply to: Dialogform container messaging

    Hello Martin,

    I would not open the subform if it is not necessary. That said make a simple method in your super table class $hasduplicates that receives the column name where you want to check if there are duplicate values. You can use a local list variable in your table class’ method copy $cinst and then use $removeduplicates on the local list. Then if your $linecount is different on the temp list than on $cinst, you know that there were duplicates.

    Make your $event method server side. That allows you to call a method within your list. If your list is based on a table class that is inherited from your super table class you have this method available and you can check if there are any dublicates before you open the dialog form. i.e.

    If iDataList.$hasduplicates()

    Do $cinst.$clientcommand(“subformdialogshow”,row(‘jsDuplicate’,#NULL,’Validate duplicate’,300,300))

    End if

    I hope this makes sense.

    Best regards,

    Andreas

  • Andreas Pfeiffer

    Administrator
    December 2, 2024 at 12:32 pm in reply to: Issues with Cross-platform app deployment in Dallas

    So what are the specific issues you are struggling?

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    November 22, 2024 at 12:28 pm in reply to: Show subformdialog command parameters

    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 22, 2024 at 8:24 am in reply to: Show subformdialog command parameters

    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

  • Andreas Pfeiffer

    Administrator
    November 13, 2024 at 5:45 pm in reply to: Worker objects

    Martin,

    Just inherit an object class from the worker you want to work with. You would need to create an object class and then go to the $superclass property and choose the right worker object. Each class has now its own $completed method that you can override.

    However the question would be why you would like to use a timer worker for a remote form? Since the worker run on server only it might be better to use a timer component on the form rather an object class – depending on what you want to do.

    There is also a challenge when you run a worker on the server to get the information back to the client. You would need to push the data to the client if the worker runs asynchronously. If the worker does not run asynchronously then you can use $cinst.$container().$myMethod to access a method of the container (the remote form) that runs the worker object (assuming the worker object is an instance variable).

    I hope this makes sense.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    November 7, 2024 at 11:28 am in reply to: Custom Font on Web remote forms

    Hello Minh,

    Yes – you can do this.

    To make the font accessible in Omnis you would need to download the font and install it on your macOS if not done already.

    Then in your library look at the system class #WIWFONTS, open it to modify and add a new line with your font name. For example add “Montserrat” to macOS column as well as the JavaScript column. You can also add more fonts to the JavaScript column as fallback fonts if you like.

    These are the two steps to make the font available in your remote form design. You can now use this font in the $font property of your fields or in your field styles if you like. The latter one might make more sense.

    But – to make the font also work on your website you would need to do additional steps:

    Open the htm file that you want to use. Note for testing it will make a copy from the jstempl.htm file that is in your html folder. So make the change there and delete the htm file that it might have created with the name of your remote form.

    Open this file with a text editor and have a look at this line:

     <link href="fonts/roboto-flex/roboto-flex.css" rel="stylesheet">

    So you would need to add a similar line that either points to your local fonts in your html/fonts folder or you could also point to a css somewhere in the web to embed your font:

    <link href="
    https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap"
    rel="stylesheet">

    If you want to have them locally you can create your own CSS file – I called it “montserrat.css” which has a similar content just like the sample that you see for Roboto but pointing to your own fonts.

    For example it could look like this one:

    @font-face {
    font-family: 'Montserrat';
    src: url('Montserrat-VariableFont_wght.ttf') ;
    }

    Having my own CSS file (“montserrat.css”) I had to add this line to the htm file:

    <link href="fonts/montserrat/montserrat.css" rel="stylesheet">

    I hope this helps.

    Best regards, Andreas

  • Andreas Pfeiffer

    Administrator
    December 15, 2024 at 11:19 am in reply to: Dialogform container messaging

    Hi Martin,

    Something went bunkers with this post. I am not able to read it. When you copy code into the forum please make sure using the preformatted tag in the editor.

    Regarding the table class, it is rather simply: Imagine that your code is inside the list. That way instead using the list name you would simply use “$cinst”. For for example $cinst.$sendall() would perform a sendall on the list if this code is inside the table class that is used for this list.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    December 14, 2024 at 1:14 pm in reply to: Dialogform container messaging

    Martin,

    I modified the $showduplicates method in the table class using the $filter instead of deleting:

    Do $cinst.$smartlist.$assign(kTrue)
    Do $cinst.$unfilter()
    Do $cinst.$sort($ref.[pColumnName])
    For $cinst.$line from 1 to $cinst.$linecount
    If $cinst.[$cinst.$line+1].[pColumnName]=$cinst.[pColumnName] ## if the next line in the current instance is identical then we can mark this line as a duplicate line
    Do $cinst.$selected.$assign(kTrue)
    Else
    Do $cinst.$selected.$assign(kFalse)
    End If
    End For
    #Do $cinst.$remove(kListKeepSelected)
    Do $cinst.$filter($ref.$selected)

    Note that I also needed to use an Else in order to change the selected status from a prior call. Actually this could also be done making a one liner instead of the If – Else construct. But that might be difficult to read.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    December 14, 2024 at 11:26 am in reply to: Dialogform container messaging

    Martin,

    I am not sure what you are trying to do here. Maybe instead deleting the lines you could make it a $smartlist=kTrue and then use the $filter method instead deleting the rows that are not duplicate? That way you could remove the filter and do another go with a different column?

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    December 13, 2024 at 11:03 am in reply to: Dialogform container messaging

    Hi Martin,

    No – creating your own methods in a table class does not mean that you are accessing the server table. A table class simply allows you to encapsulate methods that are data related instead doing this within your UI class.

    Obviously you could do this in the UI class too but I would not recommend this because you might want to re-use this method within a different context.

    I hope this makes sense.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    November 18, 2024 at 9:26 am in reply to: Worker objects

    Hi Martin,

    I would use the timer component rather the timer object. The timer control could then check an instance variable that is set pushed from the other object to the client.

    If the other object runs asynchronously then it would need to push the result and the instance variable. I’d rather recommend to run the other object synchronously as it does not require a push thought.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    November 11, 2024 at 7:59 am in reply to: jsProgressBar Control – not really controlling progress…

    Hi Martin,

    You can run code on the client that is in remote object classes. However you cannot run code that needs to run on a server. For example all the worker objects can run on the server only because this code cannot be translated into JavaScript code. Or to look this from the other side: The worker objects are not available on the client. It would need to be JavaScript only.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    November 10, 2024 at 12:40 pm in reply to: jsProgressBar Control – not really controlling progress…

    Martin,

    A client-side method can call a server side method. There is an automated approach. When you have another client-side method with the suffix return, it will automatically be called after the server side method with the same basic name has been finished. See also here https://www.omnis.net/developers/resources/onlinedocs/WebDev/02jsremoteforms.html#return-methods

Page 4 of 21