Forum Replies Created

Page 11 of 14
  • Andreas Pfeiffer

    Administrator
    July 19, 2023 at 2:47 pm in reply to: Subform questions

    Hi Mischa,

    If the subform field width is smaller than 768 it will take the next smaller layout breakpoint.

    Regarding your code generation I thought it might be worth to put an interface into a superclass of your subforms. Without any coding in the main form you could probably do something like this:

    in the $construct of your subform (or better its superclass) put the following code:

    Set reference lClassRef to $cinst.$container().$class

    Calculate iDataName as lClassRef.$objs.[$cinst.$field].$dataname

    Now you have the $dataname which could be used like this:

    Calculate iTest as $cinst.$container().[iDataName]

    From now on you could use $cinst.$container().[iDataName] to get or set the value.

    I hope that makes any sense.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    July 19, 2023 at 7:31 am in reply to: Subform questions

    Hi Mischa,

    The layout breakpoint is the minimum size of your layout. That means when the width of the browser reaches the next layout breakpoint it will change to the next layout breakpoint. So for example if you have a 320 and a 768 layout breakpoint then the 320 is shown until the browser reaches 768. Once the browser widths is 768 minimum it will use that one.

    Regarding the automated creation of a method it actually has two sides of a coin. I would assume that this code is harder to maintain. You could think of the Omnis class that the method definitions will already be stored in the library and the elegance of Omnis is that it exposes the methods graphically that are linked to the object. When you do this dynamically you remove this feature. But anyhow, I am glad that it works for you now. 🙂 There is also another downside to this. If you need to make a method client executed then you cannot create it dynamically because Omnis translates those methods into JavaScript in that moment when the class is saved (Cmd/Ctr-S).

    Regarding the click event behind the label field please check if the label is active and enabled.

    I hope this helps.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    July 18, 2023 at 7:00 am in reply to: Subform questions

    Hi Mischa,

    How many layout breakpoints does the subform have? Maybe worth deleting the bigger one?

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    July 5, 2023 at 11:45 am in reply to: Subform questions

    Hi Mischa,

    You can take subforms as separate instances and thus they ought to be and work independently. This is why I would not use the technic to access a field from the main form directly. That would mean a subform can only be used in the context of a single main form.

    That said you can obviously build interfaces between the subform and a main form. For example when a subform is constructed it might want to know the ID of the main form. Therefore I would possible have a superclass that contains a $getID method and the can then get the ID of the main form like this:

    Do $cinst.$load($cinst.$container().$getID())

    This could be in the $construct of the subform (or its superclass) that then calls its own $load using the ID of the container form.

    I especially like this technique when the $multipleclass of the subform component is set to kFalse. That makes it easier to just load the subform each time another subform is loaded.

    The other direction is also possible, calling a method within the subform from the main form:

    Do $cinst.$objs.mySubform.$subinst().$load($cinst.$getID())

    However the problem here is that you can only do this once the subform is fully loaded. Some people try to assign a new $classname and in the same stack they then try to call a method within the subform. That will not work because the stack has to be finished before you can access that instance.

    You can check this out with the little app I designed for the Madagascar event: https://www.omnis.net/community/forums/forum/discussion/contacts-web-application/

    In that application each subform has the same superclass and the superclass will then call its $load method when the form constructs. The readme file says that you would need to copy the htm files from that source. If using Omnis Studio 11, don’t do this as the htm source is slightly different. This was just because of the different font that I was using.

    I hope this helps.

    Best,

    Andreas

    Contacts Web Application

  • Hi Christoph,

    check out the new Omnis Studio 11 JS File upload / download sample in the HUB.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 7:43 am in reply to: Horizontal Complex G

    ah – now I see what you mean.

    You do not want to turn the grid, you want to turn the data – making rows to columns and vice versa.

    You would need to change your data in the list. Depending on the SQL server that you use, check out the pivot SQL function.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 7:18 am in reply to: Horizontal Complex G

    Sorry, I am still not getting it.

    Do you mean to turn the complete grid 90 degrees?

  • Andreas Pfeiffer

    Administrator
    July 25, 2023 at 1:35 pm in reply to: Subform questions

    Hi Mischa,

    I did enter an ER.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    July 20, 2023 at 9:37 am in reply to: Subform questions

    Hi Mischa,

    Yes – if you have only one layout breakpoint it will always use this one.

    Before Omnis Studio 11 the minimum number of layout breakpoints was two. For this purpose you could have changed the $layouttype property to kLayoutTypeSingle. However I think with Omnis Studio 11 it is kinda obsolete now because we can now have only one layout even though the $layouttype is set to kLayoutTypeResponsive. The beauty of this approach is that your subforms can share the same super classes. If the layout type is not the same you can actually not.

    One more about $cclass. It will work – but when it comes to inheritance you might get the wrong class. So $cinst.$class is probably what you want to get the reference of the class. Otherwise if your code is within the superclass you would get the reference to the superclass.

    I also tested making a reference variable that points to the variable that is used in the main form in the $dataname of the subform component. Unfortunately this is not supported. You cannot assign an item reference to the $dataname of a component. However you can have the reference and then have some code to assign or read from that item reference.

    I am glad that your issues are now resolved.

    Best regards,

    Andreas

  • Andreas Pfeiffer

    Administrator
    July 10, 2023 at 7:29 am in reply to: Subform questions

    Hi Mischa,

    The subform is part of the main form – yes and no. Looking at it from an OO perspective it is its own object (instance) and therefore communication between those two supposed to be via a public interface (public methods).

    In case of your example you could do the following:

    Place a public method behind your subform field, e.g. $getValue which returns the data you need to deal within your subform field.

    Then in the $construct of the subform you can access this method like this:

    Do $cinst.$field().$getValue() Returns iValue

    So instead using the $dataname you would then have a public method that allows you to communicate with the main form.

    I hope this helps.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    June 11, 2023 at 3:22 pm in reply to: Horizontal Complex G

    Hi Angelo,

    I noticed there is still a glitch. It startet to fail if the list has much more lines because the Do command could not handle the length of the argument. Therefore I changed it using a row variable for adding the line which seems to work much better.

    Please see attached lib.

    Best,

    Andreas

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 10:17 am in reply to: Horizontal Complex G

    now – also works for other language settings. Please see attached.

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 9:31 am in reply to: Horizontal Complex G

    Hello Angelo,

    Attached please find a small sample library that contains an object class that you can use to pivot any list. There is also a test window that loads a list of classes from that library to demonstrate how it works.

    One word of warning: It is expensive. So I would like to recommend using pivot functions when loading the data via SQL. That will be much quicker if there are many data.

    There is also a pitfall when you have a localised Omnis. I made some hard coded commas in there. This will fail if your parameter separator is set to something else, i.e. semicolon.

    Hope this helps.

    Best regards,

    Andreas

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 8:03 am in reply to: Horizontal Complex G

    For small lists you might be able to do this within Omnis. Give me a little time. I will provide a little sample library.

  • Andreas Pfeiffer

    Administrator
    June 9, 2023 at 7:31 am in reply to: Horizontal Complex G

    Sorry, I can only see HTM tags. Can you send a picture how it should look like?

    Thanks.

Page 11 of 14