Will this work?

Before I begin, let me preface by saying I work on accounting software. In some of the methods such as posting payroll, nesting of other methods is so deep that I cannot possibly, or at least not easily see changing the programming in our desktop version to a web version without modal dialogs. This has been a bridge I’ve had to cross for months now. I need something working for a method which during execution calls a dialog and waits for a response before continuing with the execution of the method. This has lead me to thinking about threads. I haven’t used threads yet since we started the project in web. I’m just wondering if my solution will work before I invest any more time into messing around with it. Here’s the idea.

So if I started a thread can I put the contents of a PostPayroll method in a thread? Furthermore, can I then call a new dialog from the thread and then pause the thread until I get an answer via a global variable from the dialog? (Of course I would have a default answer defined so eventually the programming would move on.) Then once I have the answer from the modal dialog global variable, could I then resume the thread and fork the programming based on the answer I received?

I know about the current way to write the continued program from the dismissed event. I have used it several times throughout our rewrite. In this case with posting payroll, I cannot in any way separate the mass amount of code forks. Any information helps and thanks everyone.

I do not recommend you to use threads on the web, only just for a message.

It is better to continue using the messages and control the execution of the code.

Previously, in a desktop payroll system, I used the following:
Response = MessageBox(“Do you want to delete something?”,“Warning”,Type2 (Yes/No))

On the web, it is not possible to do this. All code runs without stopping. So you need to set objects and run when they should.

If you explain a little what you want to achieve, maybe I can help you.

Well the whole problem is that So many different tables are opened at one time using different row selects. When about 15 or so are opened and there are so many fork checks here an there its a mess. With the school accounting we do, we have to do the debits and credits for gaap accounting and then check PERS and TRS (retirement systems). And then fork based on that. And then there is code that may be a preference by the user on what it should do and it really needs to run the dialog right then. I cant close all the databases, then create another chunk of code in different places after a dismissed event. I have to have a modal dialog and this is the only way I can see it happening is with the thread. I just need to be very careful but the most important thing is will it work?

What I mean to do is move the whole postPayroll into the thread. Then use the thread pause and resume to continue execution when I need a question answered.

Let’s see what others respond.

I see it as trying to have a runtime manager within the web page. Maybe it works.

But the complexity will increase remarkably.

The administrative processes (even if they are complex) work very well using classes that save the data while the system interacts with the user.

I think the dismissed for the dialog would then call the resume for the thread, which at that time would have an answer to whatever question I needed an answer to so I can look at it in the next statement in the thread, just as we did on desktop. I know it complicates things a little but overall its saving me from having to reinvent a very complex wheel.

Here is the working code. The main method that needs stopped runs from the thread. Then it is pause and stays there until the dialog is dismissed and then it continues based on an answer. It works perfect for what I need and emulates modal dialogs in desktops so I can have the same type of programming. Here it is for download:

https://github.com/jefferylemons/EmulateDialogStopExecution

The big question is whether I can use this? Does it cause problems that I dont know about, not being familiar with threads. Hopefully someone from Xojo can chime in?

Thanks, Jeffery

Some applications are just not designed to work as web applications. I used Quickbooks Online for 2-3 years, and it was the most painful experience I ever had using a service. A complete nightmare. The delay while clicking things was terrible. Having to rely on multiple tabs open usually did not work. It was slow, and you had to click 100 times to enter a line of data and check it in another account. Going back and forwards, constantly waiting for the thing to finally load.

I then moved to the QB Desktop and while still one of the most buggy softwares in existence, usability is miles away. Entering transactions and going from one account to another are simple clicks that respond almost instantly. It took me 6 hours to do the same in QB online, which takes 30 minutes in the desktop version.

In my experience, accounting is one of the things that does not work as a web application. Plus, your finance is some of the most private things you can expose to a third party. I prefer to have that data locally. I don’t need to access it remotely. Just my suggestion for people developing something that requires a lot of data entry, just use a native desktop app.

i think you need all informations before you run a long process.

if you use non modal dialogs, the button start the action.
means the button event know all input to start a action and where to go next.
until a click the session is idle.

example a delete dialog
the page opens with the id to delete
it show the information and ask the user are you sure.
click delete trigger delete action, have a output list, show page before with message list.
click no trigger no action, show page before.

1 Like

Accounting or administrative systems shouldn’t do it on the WEB. I think this is a false statement.

The web has many advantages. But you have to be very careful about its safety.

In this new year, you can see many web-based accounting systems in the market. The SAP and Banks systems offer another vision.

Thanks to this, they have opened up an incredible number of possibilities for presenting the data and its design. That in desktop systems only dream.

It is very different when I log into a bank account controlled by the bank than a third party service hosting my financial data. Banks and financial companies host customers data in house. I only mentioned accounting, never said anything about administrative system. In some countries, it might actually be illegal to put others people data or financials in a cloud service.

I would suggest looking into the ‘UserInterfaceUpdate’ option that has been added to Thread. I have not yet used it myself but think it might give you the capability you are looking for,

Also make sure you are using WebThread and not just Thread as a WebThread is session aware.