NetTalk Central

Show Posts

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.


Messages - Devan

Pages: 1 ... 13 14 [15] 16
211
Web Server - Ask For Help / Re: Variable scoping in NetTalk
« on: November 09, 2011, 11:41:53 PM »
Thanks for the clarification Bruce!

Tsk! over 2 decades of programming in Clarion, and I'm still trying to get a grip on mixing threaded and non threaded procedures...

I did some basic testing of this today, and it supports what you are saying... Cool !!

Cheers,
Devan

212
Web Server - Ask For Help / Re: Mobile detection and redirecting
« on: November 09, 2011, 11:38:48 PM »
Haha - Thanks Bruce, and apologies for being cheeky...

My client actually today decided to defer the mobile portion of his site until next year, and only wants the desktop version completed by Christmas, so the mad urgency is off.

Next question - to wait and begin this project in NT6 from the ground up, or start in NT5 now and upgrade later?  I assume the upgrade path will be seamless?  Or perhaps there might be some code rewrites necessary?  ;)

Can't wait to begin beta testing...  :)

Devan

213
Web Server - Ask For Help / Variable scoping in NetTalk
« on: November 09, 2011, 04:57:02 PM »
Hi all,

Ok, I know this isn't STRICTLY a NetTalk programming issue, and is something probably out of 'Programming for Beginners' that I have forgotten about - but I have a question about variable scoping in a threaded app such as NetTalk.

Of, here is the situation:  Say I have a NetWebPage or something, that is responsible for manipulating data from several files (e.g. MyFile1 and MyFile2 that contain fields such as F1:FirstField, F1:SecondField, F2:AnotherField etc.)

Ok, my NetWebPage may do something like this:

Code: [Select]
Do OpenFiles
F1:ID = 100
Access:MyFile1.Fetch(F1:PRIMARY)
F2:ID = F1:LinkedID
Access:MyFile2.Fetch(F2:PRIMARY)
... other stuff ...
ReturnString = DoSomeFunction(F1:Action)
packet = packet & ReturnString
Do SendPacket
Do CloseFiles

Ok, the issue here is when I call the DoSomeFunction() function.  This function will basically look at the F1:Action parameter, and do some string building based on the action requested.

The thing is, DoSomeFunction() needs to do some manipulation of the contents of fields in MyFile1 and MyFile2, an example snippet within this function might be:

Code: [Select]
Case PassedAction
Of 1
    RetVal = 'Hello ' & F1:FirstName & ' ' & F1:LastName & ' how are you?'
Of 2
    RetVal = 'There are ' & Records(MyFile1) & ' records to process'
Of 3
    RetVal = F1:FirstName & ', you are responsible for ' & F2:StudentName & ' until ' & Format(F2:EndDate, @D17)
End
Return(RetVal)

Basically, my question is: Can DoSomeFunction() SEE the variable contents that are passed from the calling threaded procedure?  Bear in mind, this function can be called from several different procedures - even the SAME procedure on different threads if there are a lot of users on the site.

If it CAN see the contents of the globally declared files, how safe is this method?

Is there a better way to do this, considering that the function will have to work with the contents of about 20 different files to generate the returned string?

Thanks,
Devan

214
Web Server - Ask For Help / Re: Mobile detection and redirecting
« on: November 09, 2011, 02:19:15 PM »
Thanks for the replies everyone.

Stu - I haven't even started to dabble in the multi server stuff yet, but looks like I will have to, as this now contract I just won specifies at least 3 sites running on their server for different companies.

Bruce - Thanks for the heads up.  I keenly wait for NT6... Even though I've just got go ahead for this big contract with a deadline for a 'before Christmas' ship date!!  ;)  Need any last minute NT6 beta testers??  ;D

Cheers,
Devan

215
Web Server - Ask For Help / Mobile detection and redirecting
« on: November 09, 2011, 12:03:03 AM »
Hey all,

Just wondering if there was an elegant way to detect whether someone is accessing the site via an iOS device and redirecting them to a separate series of pages that have been designed in jQuery Mobile at all?

I know that there is a .mobile property now that is accessible, but where is the best place to detect this, and should I be putting code in the WebHandler procedure to direct the user to the appropriate pages?

I am thinking along the lines of having, say 'IndexPage' as the home page for the desktop, and 'IndexPage_mobile' as the corresponding home page for the iOS device and automatically serving either page up depending on the .mobile parameter.

Could we get even trickier and support THREE sets of pages, i.e. desktop, iPhone and iPad?

Or am I jumping the gun here, and will NT6 solve all these issues for me??  ;D

Thanks!
Devan

216
Hi all,

I think I have asked before, but I have forgotten the answer now (!)

I have a webapp I am building with NetTalk, and in a heavilly customised dashboard page, I would like to give the user the option to EDIT only, a particular record.

I was thinking I could use the <!-- MyEditForm --> tag within my page to force the edit window to appear on a particular spot (div) on my dashboard, and I want the user to be able to ONLY edit the record where the Primary Key has already been set with p_web.SSV('PRI:KEY', '12345').

Is there a neat and simple way to do this, or do I have to pass parameters or similar?

Cheers,
Devan

217
Web Server - Ask For Help / Re: Dynamic Heading in a NetWebForm procedure
« on: November 02, 2011, 02:48:05 PM »
I'd be interesting in knowing if there is a quick way of doing this too.

At present I have a web app that has one MASSIVE form, with about 8 tabs and lots of fields.  It would be handy if I could dynamically pull one field (i.e. the Student Name) from the first tab, and display it above the tabs so if the user moves to another tab, they still know which student record they are working on - particularly if they step away for a couple of minutes and come back, which they are likely to do whilst entering/updating these forms.


218
Ok - I sorted it out... Basically an ID-10-T error on my part...

Decades of programming with Clarion Win32 has lulled be into a false sense of security that the record buffer will always be there and waiting, and that including 'Hot Fields' in a Browse or Drop will usually make those fields readily available in memory.

In the web environment - NO!

I ended up making the Drop list give me the ID of the record and place that in LOC:MyID, then going to the 'Client-Side' tab of the field and checking the 'Send new value to server' checkbox and clicking the 'Server Code' button to embed a short code snippet which would get the record for me:

Code: [Select]
! Fetch other related report data
p_web._OpenFile(mytable)
lsreportlist{PROP:SQL} = 'SELECT * FROM mytable WHERE ID=' & LOC:MyID
Next(mytable)
If ~Error()
    p_web.SetSessionValue('LOC:MyVar1', FIL:Field1)
    p_web.SetSessionValue('LOC:MyVar2', FIL:Field2)
Else
    p_web.DeleteSessionValue('LOC:MyVar1')
    p_web.DeleteSessionValue('LOC:MyVar2')
End
p_web._CloseFile(mytable)

Oh yeah - I had to remember that the files are not Open() at this point either, so had to manually Open() and Close() them as above...

Hope this helps another wandering soul on the NetTalk road...  ;)


219
Haa! You are correct Johan... I typed in the code snippet wrong in my tiredness very late last night...

The second line indeed should be:

p_web.SSV('LOC:MyVar2',p_web.GSV('FIL:Field2'))

Notwithstanding the introduced bug in my code, FIL:Field2 and LOC:MyVar2 are always blank at this point in the code when I inspect them in DebugView and I cannot understand why it is so...  ???

220
Powering along with some NT development lately...You can tell by the number of questions I am suddenly posting!  ;D

Ok, a frustrating problem at the moment: 

I have a file with two fields, FIL:Field1 and FIL:Field2.

I also have a WebForm with a couple of local variables LOC:MyVar1 and LOC:MyVar2

In the form, I have a drop down which pulls the value of FIL:Field1 and populates LOC:MyVar1 with it - works a treat.

Now, I whenever the user changes the drop down, I also want it to pull down the value of FIL:Field2 and populate LOC:MyVar2 with it.  Cannot make it work.

I have gone to the ValidateValue::LOC:MyVar1 and entered the following code:

Code: [Select]
LOC:MyVar2 = p_web.GSV('FIL:Field2')
p_web.SSV('LOC:MyVar2') = p_web.GSV('FIL:Field2')

I have tried setting FIL:Field2 as a Hot Field, removed it.  Tried p_web.GV() and SV() instead of GSV() and SSV() and nothing.

LOC:MyVar1 always works, LOC:MyVar2 is always blank...

221
Beautiful!!! This worked a treat, thanks guys!

So, I basically created a NetWebPage 'placeholder' page after the form that asks the user for all the parameters, then this placeholder page makes a call to the FRB Runtime Report after presetting the PDF filename etc. and then serves it up to the user.

Works brilliantly.  Thank you Kevin and Bruce for the heads up.

One tiny, tiny issue though - I remember from the NT training courses that if you prefix a filename to be served with '$$$', the WebHandler will delete the file after serving.  This doesn't seem to happen.  Is there another flag I have forgotten to set somewhere?

Thanks,
Devan

222
Hello again Bruce & the gang,

I am in the process of implementing a reporting library in a NT5 webapp... For ease of modifications to the report sets, I've decided to do them in Fomin Report Builder - that way I can just upload the RPT files and add a row to a database table to add reports to the existing set etc.

I have added the FRM -> PDF templates too, and set up FRB to print directly to PDF without any previews etc.

I have a NetTalk WebForm that takes some details from the end user, along with the report name to print, then when they hit the 'Submit' (renamed to 'Print') button, it calls the procedure 'Student_Report', which is a FRB Run Time Report.

If have put in the '(<NetWebServerWorker p_web>)' in Prototype AND Parameters in the procedure, but everytime I hit the 'Submit' button and the browser goes to 'http://xxx.xxx.xxx.xxx/Student_Report', it comes up with a 'Page Cannot Be Found' message.

What have I missed?

223
Web Server - Ask For Help / Drop downs - defaulting to LAST item on list?
« on: October 25, 2011, 08:42:10 PM »
Hi all,

I was wondering, on a NetWebForm, when you have a 'drop down' field that is populated from an external file, is there an easy way to get the display to default show the LAST item in the file, not the first?

Reason being is that I am using some drop downs to gather information for a report filter, so I am wanting to do 'first/last' drop down selectors, with the 'first' selector showing the first item in the file and the 'last' selector showing the last item in the file.

Thanks!
Devan

224
Web Server - Ask For Help / Warning the user of session timeout
« on: October 25, 2011, 03:35:41 PM »
Hi all,

I have just completed yet another web app using NetTalk 5, which my client loves  ;D , but they have come back to me with a request that has got me stumped.

Basically, they love the way the session times out after a while of inactivity, but they have asked whether it is possible to pop up a notification box that the session has timed out, or automatically navigate to the logon screen along with a message to the effect that the session has timed out?

I use Xero online for our accounting system and I note that they do this, and I think it is a good idea, especially as my web app will pretty much be left running constantly in the background at this particular organisation.

Thanks!
Devan

225
Hi Bruce,

Just chiming in here to say that I am seeing the same error on my web app that I was testing on my iPad last night.  The 'Javascript Error' red bar flickers on very briefly on each page load.

Interestingly, when testing on Chrome and Safari on a PC/Mac, I don't see that message.  Perhaps it happens too quickly in that environment?  I would have thought if it was a Webkit compatibility issue it would happen on the PC webkit based browsers too?!?

Cheers,
Devan

Pages: 1 ... 13 14 [15] 16