Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Still problems with work areas
Message
From
26/05/2017 09:15:43
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
23/05/2017 16:19:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Miscellaneous
Thread ID:
01651367
Message ID:
01651536
Views:
57
Hi Albert

None of this is VMP specific so far. If the custom object is created during app startup it's datasession is the default datasession. If your form has a private datasession, then there will be brief periods where the aliases will be invisible to it. VMP has an optional app timer feature so it can shutdown if ordered to, or on a set schedule, if you have that setup in production, but not in dev, that would complicate the production environment and differentiate it from your dev env.

Even if your make your global object a session-based object, you cannot properly encapsulate it. Imagine in the real world - not exactly VFP - but to prove the point - you have 2 alarm clocks. One is set for 1:00 and the other for 1:01. When either alarm goes off, you go do the task and it takes 2 minutes. So the first goes off, you start the task, and when the second goes off, you've not finished the first task, so you do what exactly? Your performance of the task is not encapsulated. It's being interfered with by the outside event of the second alarm.

I think you should instantiate your word template thing when your form instantiates so it remains in the form's data session, and has access to the form's data, and if you have the VMP app timer (or any other timer) running, you'll want to pause them.

You'd stop the app timer like this:
llAppTimer = oApp.tmrAppTimer.Enabled
lnAppTimer = oApp.tmrAppTimer.Interval
IF m.llAppTimer AND m.lnAppTimer > 0
oApp.tmrAppTimer.Enabled = .f.
oAapp.SetAppTimerInterval(0)
ENDIF

Do your processing.

*Restart it like this
IF m.llAppTimer AND m.lnAppTimer > 0
oApp.tmrAppTimer.Enabled = m.llAppTimer
oApp.SetAppTimerInterval(m.lnAppTimer)
ENDIF

HTH


>Hi,
>
>Thought I had this fixed but still not fixed in production. I have a form that contains a list of Word templates the users can pick that I then fire up the template in Word and pass in some data (from the current form). The list of templates is in a contained VFP table that has fields for template name, a field for a "when" expression (i.e. user can only run the template when the "when" condition evaluates to .t.) and then a field to hold the name of a procedure to convert the data into the form the template expects.
>
>e.g.
>
>lcTemplate = "Application Form x.dotm"
>
>lcWhenCondition = "RECCOUNT('apps') > 0"
>
>lcDataProcedure = "WorkUpAppData(v_Apps.App_ID)"
>
>To be able to use the overall process from form to form, many of the steps involved are in a "wrapper" class that is instantiated to a global object so I can use it all over the place. In this case, the wrapper procedure does all the basic things needed - checks that the template exits, fires up an instance of Word, creates a document from the template etc...).
>
>Problem:
>
>- on my Development machine, no errors in the overall process - ever. But when I move it to their network, I get "alias not found" errors all the time. It seems that something is making my process run "outside" of the current datasession such that it does not "see" the views that I am pulling data from. This can happen when I am either trying to EVALUATE() the "when" condition or "run" the data procedure.
>
>i.e. this works on my dev machine (lcWhenCondition as above)
>
>
>STORE EVALUATE(lcWhenCondition) TO llWhenOkay
>
>IF NOT llWhenOkay
>   * if not okay, alert user and return...
>   WAIT WINDOW (something)
>   RETURN .F.
>ENDIF
>
>
>I have tried to debug on the network by having a menu item that calls a built in "table/view viewer" - but it also "messes" with things as it is also a form that opens in its own datasession. When I invoke it and switch to the correct data session, all the tables and views are there that I require - so nothing is closing them.
>
>By rights nothing in my code should change the current data session - the code under the picklist is simple in that it picks up and passes the template name to my wrapper class method .CreateDocFromTemplate(). This wrapper class is a custom object (i.e. not a form) so that should not mess with the data session. I read through and no other object is called that changes the data session.
>
>I can also get this to work on the network if I "click around" on pages in the form that seem to somehow "force" the view to be found - even though the whole time the view shows as being open.
>
>Sign me, "stumped in Ontario".
>
>Albert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform