Jump to content

looping scripts


This topic is 6437 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

hi there,

we have 2 databases, where one is the "frontend" (users can input data via the web). the other "backend" should handle the datasets by applying timeconsuming scripts.

we'd like "backend" to loop through the following:

1. catching new datasets from "frontend" (identified by a marker, named i. e. "new")

2. setting the marker in "frontend" to i. e. "handled"

3. applying a "timeconsuming" script on each catched dataset in "backend"

4. deleting these datasets

5. if "backend" contains zero datasets: start over again from 1

since these scripts are really timeconsuming, the "frontend" would be blocked while executing.

so we decided to give this a try. but: we have no idea how to do this ...

please help.

thank you very much in advance.

michael.

Link to comment
Share on other sites

When you call a backend script from the front end, the script must be completed on the backend before the front end is released (i.e. unfrozen).

There are some tricks to getting around this problem, but you will need another workstation to perform the task (requires a plug in as well), or you need to schedule the backend tasks for off peak usage hours (scheduled tasks will not update the data until the task is run).

The best suggestion is to re-examine your backend tasks to find ways to speed these tasks up.

Link to comment
Share on other sites

Guy,

If I understand correctly, your backend script could be something like this (pseudo-code):

Loop

  Find record with "new" in marker field

  if ( found record )

    SetField[ marker, "handled" ]

    Exit Record

    PerformScript["TimeConsuming"]

    Delete Record / Request

  EndIf

  Pause[1]  ( optional, might avoid the backend machine using up too much server time )

EndLoop

If you write it like the above, you should be able to expand your operation to have multiple backends running, since they will do a new find for "new" records before each script run, and only process a single dataset at a time, leaving the others available for other backends.

Hope this helps.

Link to comment
Share on other sites

This topic is 6437 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.