This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by johnlatham]

I would really like to be able to keep data in a datastore between calls to
webpb from html. This to avoid changing my database to include tables for
temporary data. How can I do this? I've tried declaring a global datastore but
this looses it's data between transactions. Can I declare a shared datastore
to get round this, and if I can how do I do it?
Thanks
import-bot (20211) [Avatar] Offline
#2
Re: Keeping data in a datastore
[Originally posted by ezad1]

Check out page 82 "Shared Objects". You'd think that you could inherit from a
datastore and share the object with the ShareXXX functions but Powersoft says
no. I think I tried this and it worked but they aren't promoting it.

See the n_log object for a compromise. It is a nvo with a datatstore in the
instance variable. It does what you want it to do, however, it's using an
external datasource and no database connection.

> I would really like to be able to keep data in a datastore between calls to
> webpb from html. This to avoid changing my database to include tables for
> temporary data. How can I do this? I've tried declaring a global datastore but
> this looses it's data between transactions. Can I declare a shared datastore
> to get round this, and if I can how do I do it?
> Thanks
import-bot (20211) [Avatar] Offline
#3
Re: Keeping data in a datastore
[Originally posted by johnlatham]

Thanks Tom, I've sorted out this problem using the n_log method. I want the
datasource to be external for the present as I need to collect information
from several different web pages but don't want to add any data to the
database until the end (no partial records if it all falls over). It works
fine.
I've got another interesting problem that I'm trying to sort out now. A fellow
programmer has coded up some more forms etc in a seperate nvo
(u_select_params), and I have added this nvo to my .pbl. I've tried calling
the functions within this nvo from my 'main' nvo (the equivalent of u_demodb
from the book) but with no success i.e. The web browser calls a function
within u_demodb which in turn calls a function within u_select_params that
returns a string, that is then passed back to the browser. I get a 'Null
object reference' every time. I've tried declaring a global variable
(u_select_params gnv_params), a local variable (u_select_params lnv_params)
and even declaring gnv_params as a shared object as part of the open script
for the w_listen window, but with no success. Any ideas?
import-bot (20211) [Avatar] Offline
#4
Re: Keeping data in a datastore
[Originally posted by ezad1]

Is u_select_params set to autoinstantiate?
import-bot (20211) [Avatar] Offline
#5
Re: Keeping data in a datastore
[Originally posted by johnlatham]

> Is u_select_params set to autoinstantiate?
No, the object is not set to autoinstantiate (at least there is no tick
against the autoinstantiate in the 'right-click' menu). In fact I can see no
difference between between this object and the u_logview object that does not
give me any problems at all. I will try having the object in it's own .pbl and
linking this.
If this doesn't work I might resort to cutting and pasting (sorry, exporting
and importing) the code into my main object. Unless there is a way to save a
function into another object?
import-bot (20211) [Avatar] Offline
#6
Re: Keeping data in a datastore
[Originally posted by ezad1]

> > Is u_select_params set to autoinstantiate?
> No, the object is not set to autoinstantiate (at least there is no tick
> against the autoinstantiate in the 'right-click' menu). In fact I can see no
> difference between between this object and the u_logview object that does not
> give me any problems at all. I will try having the object in it's own .pbl and
> linking this.
> If this doesn't work I might resort to cutting and pasting (sorry, exporting
> and importing) the code into my main object. Unless there is a way to save a
> function into another object?

Since it isn't set to autoinstantiate, where are you creating the object?
import-bot (20211) [Avatar] Offline
#7
Re: Keeping data in a datastore
[Originally posted by johnlatham]

> > > Is u_select_params set to autoinstantiate?
> > No, the object is not set to autoinstantiate (at least there is no tick
> > against the autoinstantiate in the 'right-click' menu). In fact I can see no
> > difference between between this object and the u_logview object that does
not
> > give me any problems at all. I will try having the object in it's own .pbl
and
> > linking this.
> > If this doesn't work I might resort to cutting and pasting (sorry, exporting
> > and importing) the code into my main object. Unless there is a way to save a
> > function into another object?
>
> Since it isn't set to autoinstantiate, where are you creating the object?

I've tried creating an instance of it as a local variable, global variable,
and shared object but I can't get it to work. I currently have other objects
running without problems like this (overloaded functions in u_el_html_form
declared locally, functions within shared objects etc etc), but I have no idea
why this one object should be different. I've tried rebuilding the code and
optomising it but this didn't help.
If these functions are called directly from a browser they work correctly.