Modal Prompts in JS

John Boehme john at integralservices.biz
Thu Nov 21 17:00:13 EST 2019


Hi Jim,

Not sure if I understand your question totally. Here is what I think
applies:

We have these class objects that manage a record for a table, and, various
connected records to that main record.
When retrieving a "document" as we call it, we also load up the child
records. This may result in many db requests to retrieve each of the child
records for the main document.

With a local connection to the db, this is irrelevant. However, when
connecting to a remote db, the delay for each request is very significant.
The same <1s process on a local db may take 10-15, 30 seconds on a remote db
just retrieving the child records.

For certain reports, where complete detail of an individual document is
required, I tried this approach which seems to work pretty neat. I use a
structure like this as a column calculation:

    ( SELECT string_agg(concat(n.note_date, '\t', n.note_text), '\~'::text)
AS note_list
           FROM notes n
          WHERE (n.doc_uid = doc.doc_uid)
          GROUP BY n.doc_uid) AS notes,

Where doc.doc_uid is the parent record key.

What this select does is build a delimited list of columns/records from the
notes linked to a document. So for each document, one column has a list of
all its notes. We actually have several columns pulled back with other child
lists of the document we're retrieving.

When using joins, you'll get multiple records for the main record depending
on the number of child records. With this approach, we get one record
returned for each main record. All the child records for each record are in
columns of the record. So only one db request to get everything.

To retrieve the data from the column, we run the data through a parser that
translates the delimited records into a list:

Do $cinst.$getList(iNotesList,ivMainList.note_list)

Where ivMainList.note_list is a child list of a main record retrieve with
the sql above, and upon return, the iNotesList is populated with the data
from ivMainList.note_list.

A similar approach would be to use a json service, which would handle the
data in pretty much in the same way except in a much a nicer format.

Good luck.

John Boehme
Integral Consulting Services
Bothell, WA
940-597-3046

-----Original Message-----
From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf
Of Jim Pistrang
Sent: Thursday, November 21, 2019 10:21 AM
To: Omnis List Mail
Subject: Re: Modal Prompts in JS

Hi all,

Similar to Will, I am working on a strategy for presenting a prompt in the
js environment.  My prompt will need to appear on multiple forms, and it is
more complex than a simple OK or Yes/No message.

My js forms all have a common superclass, so I was hoping to place a 'prompt
box' on the superclass in the form of a paged pane that would be invisible
by default but made visible to display a prompt.  This works, BUT the $order
of the superclass paged pane is a lower number than the child form objects,
so the paged pane appears behind other objects on the form.  Is there
something I can do to get the paged pane in front of the other objects?

Jim



>
>Hi All,
>
>I'm missing the Euromnis get-together this year, hope you're all doing 
>well though.
>
>This is a question about prompts and the Omnis mechanism that runs the 
>JS remote forms. We have about 3000 Yes/No messages in our app as well 
>as a bunch or other prompts that require some form of user choice 
>before continuing - they all run from a single task level object 
>variable that builds and displays a suitable prompt then returns with 
>the user selection. The problem is that this is often in the middle of 
>a method i.e. halfway through processing an invoice, we might warn if 
>the stock is going to drop below a level and ask if they want to 
>continue... for example...
>
>In the current system this is modal, so Omnis execution pauses at that 
>point in the method stack while we wait for a response. I had hoped to 
>do something similar with JS forms so that we do not have to spilt and 
>rewrite the majority of our core methods, however it does not appear to 
>be that easy.
>
>I know that the browser on the client runs asynchronously to the Omnis 
>server but was hoping I could work around it by issuing the client 
>command to show a Yes/No prompt and then immediately entering a while 
>loop while we wait for a user response, (in order to keep Omnis 
>executing within our prompt method). When the browser responds with a 
>result it would change the condition of the while loop and then we 
>would then exit with the response. In this way the JS version works the 
>same as the thick client and if there are multiple remote tasks they 
>can time slice on the server and would still be responsive.
>
>But it does not work. The browser does not display the Yes/No prompt 
>until the Omnis code stops executing on the server, which means we have 
>to exit the method and then start a new stack after the user response, 
>which means we need to rewrite any code that contains a Yes/No. Hmmm.
>
>The above process may not be the best way to structure code, but it 
>would save us a hell of a lot of time. Is there are a way I can "flush"
>the current method stack to force Omnis to update the client mid-stack?
>Perhaps there is another way to simulate a modal response in the world 
>of JS remote forms?
>
>Any thoughts? All Ideas welcome!
>
>Best regards
>
>Will
>
>
>
>[Lineal Software Solutions]        <http://www.lineal.co.uk>
>
>[Twitter]<https://twitter.com/linealsoftware>  [Facebook] <https://
>www.facebook.com/linealsoftware?fref=ts&ref=br_tf>   [Google +] <https://
>plus.google.com/112982815000763473226/about>   [LinkedIn] <https://
>www.linkedin.com/company/1859834?trk=
>tyah&trkInfo=clickedVertical%3Acompan
>y%2Cidx%3A1-1-1%2CtarId%3A1437729256906%2Ctas%3Alineal%20s>
>
>[https://s3.amazonaws.com/htmlsig-assets/spacer.gif]
>
>Will Adkin  / Software Development Manager 
>will at lineal.co.uk<mailto:will at lineal.co.uk>
>
>Lineal Software Solutions
>01271 375999
>Commercial House, The StrandBarnstaple, Devon, EX31 1EU 
>www.lineal.co.uk<http://www.lineal.co.uk>
>
>
>
>This e-mail message may contain confidential or legally privileged 
>information and is intended only for the use of the intended 
>recipient(s). Any unauthorized disclosure, dissemination, distribution, 
>copying or the taking of any action in reliance on the information 
>herein is prohibited. E-mails are not secure and cannot be guaranteed 
>to be error free as they can be intercepted, amended, or contain viruses.
>Anyone who communicates with us by e-mail is deemed to have accepted 
>these risks. Lineal is not responsible for errors or omissions in this 
>message and denies any responsibility for any damage arising from the 
>use of e-mail. Any opinion and other statement contained in this 
>message and any attachment are solely those of the author and do not 
>necessarily represent those of the company.
>
>_____________________________________________________________
>Manage your list subscriptions at http://lists.omnis-dev.com Start a 
>new message -> mailto:omnisdev-en at lists.omnis-dev.com
>

--
Jim Pistrang
JP Computer Resources
413-256-4569
<https://jpcr.com>


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 




More information about the omnisdev-en mailing list