This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
10741
Web Server - Ask For Help / Re: Lookup
« on: August 01, 2007, 06:35:51 AM »
Ok, here's an update.
In version 4.29 the browse-when-called-as-a-lookup is a bit smarter when the Form Field already contains something.
a) It starts by assuming the form field already contains a valid value. If so it jumps to this record (regardless of the browse's sort order). the browse sort order is explicitly set by the Form Field Lookup settings.
b) If that fails (ie the code is not valid) then it assumes the form field contains what can be thought of as a "locator". The sort order specified by the Form Field Lookup settings is applied and the browse "jumps" to the nearest position to the current Form Field value.
c) If you wish to add even smarter code, a good place to do it is the embed point, in the browse, called "After Setting Browse Behavior Settings". To jump to the record of your choice do whatever you need to do and finish with
p_web.SetValue('fil:id',fil:id)
where fil:id is the unique identifier for the browse (ie component of unique, unchanging key) and where it contains the value you want to jump to.
Cheers
Bruce
In version 4.29 the browse-when-called-as-a-lookup is a bit smarter when the Form Field already contains something.
a) It starts by assuming the form field already contains a valid value. If so it jumps to this record (regardless of the browse's sort order). the browse sort order is explicitly set by the Form Field Lookup settings.
b) If that fails (ie the code is not valid) then it assumes the form field contains what can be thought of as a "locator". The sort order specified by the Form Field Lookup settings is applied and the browse "jumps" to the nearest position to the current Form Field value.
c) If you wish to add even smarter code, a good place to do it is the embed point, in the browse, called "After Setting Browse Behavior Settings". To jump to the record of your choice do whatever you need to do and finish with
p_web.SetValue('fil:id',fil:id)
where fil:id is the unique identifier for the browse (ie component of unique, unchanging key) and where it contains the value you want to jump to.
Cheers
Bruce
10742
Web Server - Ask For Help / Re: Lookup
« on: August 01, 2007, 04:06:06 AM »
One part of the question is simple, the other is actually quite complex.
First the simple bit - the filter. Filters are easy enough to do on the browse, use a conditional filter. Use a session variable, set (presumably) by a form field on the calling form. (set session value using simple "send new value to server".)
Now your "jump into lookup near closest record" gets a tad complicated. Because in the form field you're allowing them to type either the code, or the first part of the description. If I type 11 should I jump into the lookup near code "110" or near description "11 East Boulevard"?
One approach is to test it first to see if it is a complete, valid, code. If it is jump there, if not jump to the nearest "description". I haven't worked out the kinks in this approach yet though.
Aside: Incidentally in 4.29 I've added a field to the lookup so that you can specify the sort oder for the lookup procedure.
cheers
Bruce
First the simple bit - the filter. Filters are easy enough to do on the browse, use a conditional filter. Use a session variable, set (presumably) by a form field on the calling form. (set session value using simple "send new value to server".)
Now your "jump into lookup near closest record" gets a tad complicated. Because in the form field you're allowing them to type either the code, or the first part of the description. If I type 11 should I jump into the lookup near code "110" or near description "11 East Boulevard"?
One approach is to test it first to see if it is a complete, valid, code. If it is jump there, if not jump to the nearest "description". I haven't worked out the kinks in this approach yet though.
Aside: Incidentally in 4.29 I've added a field to the lookup so that you can specify the sort oder for the lookup procedure.
cheers
Bruce
10743
Web Server - Ask For Help / Re: Different browse grid
« on: August 01, 2007, 12:57:42 AM »
Hi Greg,
I'm not 100% sure I know what you're asking. Maybe make a screen shot of what you have in mind?
Cheers
Bruce
I'm not 100% sure I know what you're asking. Maybe make a screen shot of what you have in mind?
Cheers
Bruce
10744
Web Server - Ask For Help / Re: Session queue and value queue
« on: August 01, 2007, 12:56:28 AM »
Hi Rhys,
>> the value queue is only available in the current page
a better description might be
"the value queue is only available in the current thread"
A page may make many (asynchronous) requests to the server. Or (like on a form) it may "pop out" to do a lookup, then "come back". These are all new threads, so the Value queue isn't available in these.
As a rule, if you are using parameters on a URL, always save them to the Session Q, and use the Session Q values in any activity. To save the values you can do
p_web.StoreValue('whatever')
This is equivalent to
if p_web.IfExistsValue('whatever')
p_web.SetSessdionqueue('whatever',p_web.GetValue('whatever'))
end
Cheers
Bruce
>> the value queue is only available in the current page
a better description might be
"the value queue is only available in the current thread"
A page may make many (asynchronous) requests to the server. Or (like on a form) it may "pop out" to do a lookup, then "come back". These are all new threads, so the Value queue isn't available in these.
As a rule, if you are using parameters on a URL, always save them to the Session Q, and use the Session Q values in any activity. To save the values you can do
p_web.StoreValue('whatever')
This is equivalent to
if p_web.IfExistsValue('whatever')
p_web.SetSessdionqueue('whatever',p_web.GetValue('whatever'))
end
Cheers
Bruce
10745
Web Server - Ask For Help / Re: Child browse problem
« on: August 01, 2007, 12:50:35 AM »
Hi Shane,
Can you please send me an example?
Cheers
Bruce
Can you please send me an example?
Cheers
Bruce
10746
Web Server - Ask For Help / Re: PDF Report using EE
« on: August 01, 2007, 12:49:49 AM »
Hi Wesley,
If you run it in Firefox what happens?
What version of IE & NetTalk are you using?
Cheers
Bruce
If you run it in Firefox what happens?
What version of IE & NetTalk are you using?
Cheers
Bruce
10747
Web Server - Ask For Help / Re: Prop:SQLFilter
« on: August 01, 2007, 12:47:42 AM »
Hi Rhys,
There's an embed point in the browse called "Browse Filter".
This happens after the filter is "constructed".
So this is probably the best place to use prop:SqlFilter.
Be aware though that the locator functionality makes use of the filter (and alters it) in the SetView statement. So the + form of the SQL filter is probably gonna work the best for you.
Of course a better approach is to use the SQL () statement inside the regular filter. This would then have the minimum number of side effects.
Cheers
Bruce
There's an embed point in the browse called "Browse Filter".
This happens after the filter is "constructed".
So this is probably the best place to use prop:SqlFilter.
Be aware though that the locator functionality makes use of the filter (and alters it) in the SetView statement. So the + form of the SQL filter is probably gonna work the best for you.
Of course a better approach is to use the SQL () statement inside the regular filter. This would then have the minimum number of side effects.
Cheers
Bruce
10748
Web Server - Ask For Help / Re: LOC:Required
« on: August 01, 2007, 12:39:05 AM »
I've done this for version 4.29.
You can override the property in .ProcessLink
self.site.RequiredText = 'whatever'
Cheers
Bruce
You can override the property in .ProcessLink
self.site.RequiredText = 'whatever'
Cheers
Bruce
10749
Web Server - Ask For Help / Re: Update multiple records from form?
« on: August 01, 2007, 12:23:15 AM »
Hi Rhys,
You're gonna have to manually check the secondary record anyway (to determine if the record already exists) and that implies a FETCH and so the Form fields are gonna be overwritten at that point.
You can then update the form fields from the session queue using the.SessionQueueTofile method. But that _might_ bring unwelcome fields along that have been left behind from an earlier visit to the session queue.
Ok, so I think your code is in 2 parts.
a) you need to prime the fields when the form is opened, and
b) you need to save them when the form is closed.
So on the for, in the preInsert, preUpdate, and preDelete (?) methods you need to prime the record. They'll look something like this;
Access:Secfile.Open()
Access:Secfile.UseFile()
! prime record, and fetch to see if it exists, if it doesn't exist then set a session variable so we know we're doing an Insert later on.
sec:id = whatever
If Access:Secfile.Fetch(dec:idKey) <> 0
p_web.SetSessionValue('secaction','insert')
! add any field priming-on-insert here
sec:id = whatever
Else
p_web.SetSessionValue('secaction','change')
End
p_web.FileToSessionQueue(secfile)
Access:SecFile.Close()
Now for part b
this code in the ValidateInsert et al, or PostInsert et al.
Access:Secfile.Open()
Access:Secfile.UseFile()
if p_web.GetSessionValue('secaction') = 'change'
sec:id = whatever
If Access:Secfile.Fetch(dec:idKey) <> 0
p_web.SessionQueueToFile(secfile)
Access:SecFile.Update()
End
elsif p_web.GetSessionValue('secaction') = 'insert'
p_web.SessionQueueToFile(secfile)
Access:SecFile.Insert()
end
Access:SecFile.Close()
Cheers
Bruce
You're gonna have to manually check the secondary record anyway (to determine if the record already exists) and that implies a FETCH and so the Form fields are gonna be overwritten at that point.
You can then update the form fields from the session queue using the.SessionQueueTofile method. But that _might_ bring unwelcome fields along that have been left behind from an earlier visit to the session queue.
Ok, so I think your code is in 2 parts.
a) you need to prime the fields when the form is opened, and
b) you need to save them when the form is closed.
So on the for, in the preInsert, preUpdate, and preDelete (?) methods you need to prime the record. They'll look something like this;
Access:Secfile.Open()
Access:Secfile.UseFile()
! prime record, and fetch to see if it exists, if it doesn't exist then set a session variable so we know we're doing an Insert later on.
sec:id = whatever
If Access:Secfile.Fetch(dec:idKey) <> 0
p_web.SetSessionValue('secaction','insert')
! add any field priming-on-insert here
sec:id = whatever
Else
p_web.SetSessionValue('secaction','change')
End
p_web.FileToSessionQueue(secfile)
Access:SecFile.Close()
Now for part b
this code in the ValidateInsert et al, or PostInsert et al.
Access:Secfile.Open()
Access:Secfile.UseFile()
if p_web.GetSessionValue('secaction') = 'change'
sec:id = whatever
If Access:Secfile.Fetch(dec:idKey) <> 0
p_web.SessionQueueToFile(secfile)
Access:SecFile.Update()
End
elsif p_web.GetSessionValue('secaction') = 'insert'
p_web.SessionQueueToFile(secfile)
Access:SecFile.Insert()
end
Access:SecFile.Close()
Cheers
Bruce
10750
Web Server - Ask For Help / Re: Track operator activity
« on: August 01, 2007, 12:11:56 AM »
Hi Rhys,
There are 2 approaches to this.
The first is to put a "timer" into the web page so that you can see the timer, and work from there.
This is a bit icky though. Firstly you're generating extra traffic, and of course it doesn't tell you if the user just left their browser on that page overnight.
A better approach is to make use of the Session Queue. By querying this at regular intervals you can take "snap shots" of who is online, and who is not.
Better yet, all you really need to trap is
a) when the user logs in and
b) when he either logs out, or the session automatically terminates.
The first part is easy to do (since you have to manage the login anyway).
The second bit is also easy, if a bit cunning.
the WebServer procedure contains an object based on the NetWebServer class. So in this is a method called _DeleteSession.
This method is called whenever a session is deleted (meaning it has been inactive for a period of time). So in this method, before the parent call, you can add any code you like.
At that point you've got to be a bit careful, because you're working inside the server (which is shared.) Plus the normal GetSessionValue changes to _GetSessionValue so the code would look something like this;
err Long
x = self._GetSessionValue(p_SessionID,'whatever',err)
if err = 0
! do something with x
end
cheers
Bruce
There are 2 approaches to this.
The first is to put a "timer" into the web page so that you can see the timer, and work from there.
This is a bit icky though. Firstly you're generating extra traffic, and of course it doesn't tell you if the user just left their browser on that page overnight.
A better approach is to make use of the Session Queue. By querying this at regular intervals you can take "snap shots" of who is online, and who is not.
Better yet, all you really need to trap is
a) when the user logs in and
b) when he either logs out, or the session automatically terminates.
The first part is easy to do (since you have to manage the login anyway).
The second bit is also easy, if a bit cunning.
the WebServer procedure contains an object based on the NetWebServer class. So in this is a method called _DeleteSession.
This method is called whenever a session is deleted (meaning it has been inactive for a period of time). So in this method, before the parent call, you can add any code you like.
At that point you've got to be a bit careful, because you're working inside the server (which is shared.) Plus the normal GetSessionValue changes to _GetSessionValue so the code would look something like this;
err Long
x = self._GetSessionValue(p_SessionID,'whatever',err)
if err = 0
! do something with x
end
cheers
Bruce
10751
Web Server - Ask For Help / Re: Notify app frame from web server?
« on: July 31, 2007, 11:57:23 PM »
Hi Tony,
Ok, so your menu item has a URL - probably a NetWebPage procedure name or some thing like that.
It can of course be the "front page" - as in "I'm looking at the main/index page, and I click the URL, and it takes me to the page I'm looking at."
You can also add a parameter to the URL. For example
'index.htm?Notify=yes'
Then in that netwebpage put something like this :
if p_web.IfExistsValue('notify')
NOTIFY etc etc
End
Cheers
Bruce
Ok, so your menu item has a URL - probably a NetWebPage procedure name or some thing like that.
It can of course be the "front page" - as in "I'm looking at the main/index page, and I click the URL, and it takes me to the page I'm looking at."
You can also add a parameter to the URL. For example
'index.htm?Notify=yes'
Then in that netwebpage put something like this :
if p_web.IfExistsValue('notify')
NOTIFY etc etc
End
Cheers
Bruce
10752
Web Server - Ask For Help / Re: reselecting field after incorrect entry.
« on: July 31, 2007, 11:53:38 PM »
Hi Greg,
Not so easy to do unfortunately.
This would require code executing asynchronously after the comment has been sent to the server. At the moment it can only send data, not code.
Also, depending on speed, they _might_ already have typed some letters in the new field so changing focus asynchronously might be a bit disturbing to the user.
Cheers
Bruce
Not so easy to do unfortunately.
This would require code executing asynchronously after the comment has been sent to the server. At the moment it can only send data, not code.
Also, depending on speed, they _might_ already have typed some letters in the new field so changing focus asynchronously might be a bit disturbing to the user.
Cheers
Bruce
10753
Web Server - Ask For Help / Re: Passing special chars ? % in addressline
« on: July 31, 2007, 11:50:54 PM »
There's a method called "Escape" which will do this for you.
So if you have a string (let's call it Fil:Name) and you want to use it as a URL, and it might contain icky characters, then do
p_web.Escape(fil:name)
Some other methods that might be useful :
p_web._noColon: removes colons from variable and procedure names. This is necessary because HTML doesn't allow colons in variable names. You'll see this method called for you a lot by the template. You shouldn't need to use it yourself unless you are doing fancy hand-coded things.
p_web._jsok: data passed to the browser has to be valid XHTML. This is especially true of stuff passed asynchronously (like a browse update). the _jsok method encodes characters that would break the XML. (like \ or < etc)
cheers
Bruce
So if you have a string (let's call it Fil:Name) and you want to use it as a URL, and it might contain icky characters, then do
p_web.Escape(fil:name)
Some other methods that might be useful :
p_web._noColon: removes colons from variable and procedure names. This is necessary because HTML doesn't allow colons in variable names. You'll see this method called for you a lot by the template. You shouldn't need to use it yourself unless you are doing fancy hand-coded things.
p_web._jsok: data passed to the browser has to be valid XHTML. This is especially true of stuff passed asynchronously (like a browse update). the _jsok method encodes characters that would break the XML. (like \ or < etc)
cheers
Bruce
10754
Web Server - Ask For Help / Re: how to chain to a net:webpage from a custom button?
« on: July 31, 2007, 11:19:14 PM »
Hi Bram,
The second part of the question is the most important.
>> After that I want to chain to a Net:webpage
Remember the server can't "push" pages to the client. The client has to request them. The requests are either GET's or POSTS.
With that in mind, the Button _has_ to have a URL - the URL of the page you want to go to.
Since the Save button will do this, I reckon it's probably best to put that back.
If you want to embed code, triggered by the save button, then put it int he ValidateAll routine in the form.
cheers
Bruce
The second part of the question is the most important.
>> After that I want to chain to a Net:webpage
Remember the server can't "push" pages to the client. The client has to request them. The requests are either GET's or POSTS.
With that in mind, the Button _has_ to have a URL - the URL of the page you want to go to.
Since the Save button will do this, I reckon it's probably best to put that back.
If you want to embed code, triggered by the save button, then put it int he ValidateAll routine in the form.
cheers
Bruce
10755
Web Server - Ask For Help / Re: LOC:Required
« on: July 22, 2007, 10:32:59 PM »
hi Rene,
The only way to do it at the moment is edit the line in
netweb.tpw
Loc:Required = 'Required'
to
!Loc:Required = 'Required'
I've put it on the list.
Cheers
Bruce
The only way to do it at the moment is edit the line in
netweb.tpw
Loc:Required = 'Required'
to
!Loc:Required = 'Required'
I've put it on the list.
Cheers
Bruce