11
Web Server - Ask For Help / Re: NT Maps - update calling different table/record
« Last post by Bruce on March 23, 2025, 11:28:36 PM »>> the approach of having a second update form on the update form for the point record, is that a good approach?
no.
A better approach, one that will work, is to call the form you want to call. In the example you sent me that would be UpdateUser, in your real app I expect it's UpdateJob, or whatever.
So now the issue is getting the correct record loaded in that table. I'll refer to the example you sent - the map is plotting the accidents, but you want to UpdateUser. So in UpdateUser, in the InitForm routine you need to prime the GUID value of the user to edit.
At this point all you have is the sesison value for the Accident. So the code goes something like this;
Access:Accident.Open()
Access:Accident.UseFile()
Acc:Guid = p_web.GSV('Acc:Guid')
Access:Accident.TryFetch(Acc:GuidKey)
User:Guid = Acc:UserGUID
Access:Accident.Close()
p_web.SetValue('Use:Guid',Use:Guid)
p_web.SetSessionValue('Use:Guid',Use:Guid)
This loads the Use:Guid into the Value, and SessionValue queues, and from there the form can take over.
Cheers
Bruce
no.
A better approach, one that will work, is to call the form you want to call. In the example you sent me that would be UpdateUser, in your real app I expect it's UpdateJob, or whatever.
So now the issue is getting the correct record loaded in that table. I'll refer to the example you sent - the map is plotting the accidents, but you want to UpdateUser. So in UpdateUser, in the InitForm routine you need to prime the GUID value of the user to edit.
At this point all you have is the sesison value for the Accident. So the code goes something like this;
Access:Accident.Open()
Access:Accident.UseFile()
Acc:Guid = p_web.GSV('Acc:Guid')
Access:Accident.TryFetch(Acc:GuidKey)
User:Guid = Acc:UserGUID
Access:Accident.Close()
p_web.SetValue('Use:Guid',Use:Guid)
p_web.SetSessionValue('Use:Guid',Use:Guid)
This loads the Use:Guid into the Value, and SessionValue queues, and from there the form can take over.
Cheers
Bruce
12
Web Server - Ask For Help / Re: web26 example File Upload
« Last post by Richard I on March 23, 2025, 10:23:19 PM »Many thanks Bruce.
regards,
Richard
regards,
Richard
13
Web Server - Ask For Help / Re: web26 example File Upload
« Last post by Bruce on March 23, 2025, 09:56:01 PM »The example is confused by the existence of the Doc:Name field twice on the form, once as a string and once as a file upload. I'll play around with that a bit, but in the meantime if you remove the second field then I think the form will work as you are expecting.
14
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by Bruce on March 23, 2025, 09:03:03 PM »>> I have a client that no longer wants to store dates in his app. Instead, he wants to store the number of days from a reference date.
I strongly recommend you use Dec 28th, 1800 as the reference date. If you do this then there's effectivly nothing to do, just store the date as a LONG.
Cheers
Bruce
I strongly recommend you use Dec 28th, 1800 as the reference date. If you do this then there's effectivly nothing to do, just store the date as a LONG.
Cheers
Bruce
15
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by Bruce on March 23, 2025, 09:00:21 PM »>> You will need to run a debugger program to see the TRACE statements.
I recommend DebugView++. It's not a debugger, it's a message viewer.
>> I am lazy,
hard to see how it's less work than a single double-click.
Bruce
I recommend DebugView++. It's not a debugger, it's a message viewer.
>> I am lazy,
hard to see how it's less work than a single double-click.
Bruce
16
Web Server - Ask For Help / Re: Coding a date field to be a particular day date
« Last post by Richard I on March 23, 2025, 08:43:38 PM »Thanks Niels for the heads up re "DAY"
FYI
The Code is now sorted , provided the date column in the CSV file is changed to dd/mm/yyyy
herewith for your interest
SET(Lineitems)
Access:Lineitems.usefile
OPEN (Lineitems)
Relate:ImportCSV.OPEN
SET(ImportCSV)
LOOP until Access:ImportCSV.Next()
Lin:UserName = p_web.GSV('Username')
Lin:Quantity = 1
Lin:Product = ImpCSV:Label3
Lin:Price = ImpCSV:Label6
Lin:IncomeItem = 0
IF Lin:Price > 1 THEN Lin:IncomeItem = 1 END
IF LIN:Price < 1 THEN LIN:Price = (LIN:Price * -1 ) END
Lin:Total = Lin:Price
Lin:date = deformat( ImpCSV:Label7),@D6)
locNewDate = LIN:Date
locdaydate = DAY(Lin:Date)
LIN:Date = (locNewDate - locdaydate) +1
INV:Date = Lin:date
IF access:Invoice.Fetch(INV:byDateDescending) = LEVEL:Benign
Lin:InvoiceNumber = INV:ID
END
Access:LineItems.Insert()
END
loc:Alert = 'Your Bank Statement has been Imported.'
Regards,
Richard
FYI
The Code is now sorted , provided the date column in the CSV file is changed to dd/mm/yyyy
herewith for your interest
SET(Lineitems)
Access:Lineitems.usefile
OPEN (Lineitems)
Relate:ImportCSV.OPEN
SET(ImportCSV)
LOOP until Access:ImportCSV.Next()
Lin:UserName = p_web.GSV('Username')
Lin:Quantity = 1
Lin:Product = ImpCSV:Label3
Lin:Price = ImpCSV:Label6
Lin:IncomeItem = 0
IF Lin:Price > 1 THEN Lin:IncomeItem = 1 END
IF LIN:Price < 1 THEN LIN:Price = (LIN:Price * -1 ) END
Lin:Total = Lin:Price
Lin:date = deformat( ImpCSV:Label7),@D6)
locNewDate = LIN:Date
locdaydate = DAY(Lin:Date)
LIN:Date = (locNewDate - locdaydate) +1
INV:Date = Lin:date
IF access:Invoice.Fetch(INV:byDateDescending) = LEVEL:Benign
Lin:InvoiceNumber = INV:ID
END
Access:LineItems.Insert()
END
loc:Alert = 'Your Bank Statement has been Imported.'
Regards,
Richard
17
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by rjolda on March 20, 2025, 01:00:48 PM »HI Jeff,
You will need to run a debugger program to see the TRACE statements.
When I am not wanting to run a debugger, and I am lazy, I just put in a message statement with a display of the variable field and its value. My message windows are set to time out after 3 seconds so they will auto close and the program will keep running.
Yes, I always get the ruler smashed across the knuckles but this is sometimes a quick way to get an answer to a simple problem!
Ron
You will need to run a debugger program to see the TRACE statements.
When I am not wanting to run a debugger, and I am lazy, I just put in a message statement with a display of the variable field and its value. My message windows are set to time out after 3 seconds so they will auto close and the program will keep running.
Yes, I always get the ruler smashed across the knuckles but this is sometimes a quick way to get an answer to a simple problem!
Ron
18
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by jking on March 20, 2025, 04:33:10 AM »Ron,
Thanks for the replies. I'll try your advice and get back to you.
Jeff
Thanks for the replies. I'll try your advice and get back to you.
Jeff
19
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by rjolda on March 19, 2025, 04:25:17 PM »HI Jeff,
sometimes the Display field drives me nuts. I would put a p_Web.Trace(' calculated value:' & loc:DateInterval ) when the calculation is done. I suspect that the calculation is done on the Server side when the second date is entered. That is where I would put the trace. If you get the correct value in the trace, then your math is correct - it is simply a display issue. Some of these forms go in and out of scope so many times, I find it is easier to place the value in p_web.SSV('loc:DateInterval' , loc:DateInterval ). I would then repeat the trace with p_Web.Trace(' calculated value:' & p_web.GSV('loc:DateInterval') ). If you are getting the correct value then try displaying the Session value for loc:DateInterval. That would be my suggestion as to how to see what is going on. Trace really helps sort these things out.
Ron
sometimes the Display field drives me nuts. I would put a p_Web.Trace(' calculated value:' & loc:DateInterval ) when the calculation is done. I suspect that the calculation is done on the Server side when the second date is entered. That is where I would put the trace. If you get the correct value in the trace, then your math is correct - it is simply a display issue. Some of these forms go in and out of scope so many times, I find it is easier to place the value in p_web.SSV('loc:DateInterval' , loc:DateInterval ). I would then repeat the trace with p_Web.Trace(' calculated value:' & p_web.GSV('loc:DateInterval') ). If you are getting the correct value then try displaying the Session value for loc:DateInterval. That would be my suggestion as to how to see what is going on. Trace really helps sort these things out.
Ron
20
Web Server - Ask For Help / Re: Modify the lookup procedure?
« Last post by jking on March 19, 2025, 10:41:33 AM »Hello all,
I continue to work on this, now I'm taking a different route. I have a button next to a field that calls a memory form. See the attached image. The form has two date fields and a third numeric field. I want to enter the two dates and then populate the numeric field with the difference between the two dates. In the ValidateAll embed I have the following:
loc:DateInterval = loc:ReferenceDate - loc:TargetDate
For the ReferenceDate and TargetDate fields, I have set these to reset the loc:DateInterval field on the client-side tab. Still, the loc:DateInterval field is not filled in. I suspect my embed code is wrong and/or I'm using the wrong embed. Can anyone help with this?
Thanks,
Jeff King
I continue to work on this, now I'm taking a different route. I have a button next to a field that calls a memory form. See the attached image. The form has two date fields and a third numeric field. I want to enter the two dates and then populate the numeric field with the difference between the two dates. In the ValidateAll embed I have the following:
loc:DateInterval = loc:ReferenceDate - loc:TargetDate
For the ReferenceDate and TargetDate fields, I have set these to reset the loc:DateInterval field on the client-side tab. Still, the loc:DateInterval field is not filled in. I suspect my embed code is wrong and/or I'm using the wrong embed. Can anyone help with this?
Thanks,
Jeff King