The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
update existing record
Posted: 02 Dec 08 9:42 AM
|
Greetings all,
I am using .addnew to insert a record with 98 fields into a custom table (managed form.) Now, rather than having the .open sql "where 1 = 2", I'm opening the recordset "where tableid = 'xxxxxxxxxxxx'". I am changing the fields("xxxx").value, then trying to use .update to update the table.
Am I doing this wrong? I tried to copy the format from the Tickets Activities Support script, but getting no errors and no table updates.
Michael |
|
|
|
Re: update existing record
Posted: 03 Dec 08 3:11 AM
|
That won't work if you didn't actually find a row (i.e. there was nothing there). You'd have to issue a .AddNew first. You can do this by checking .RecordCount (as you won't want this .AddNew if the row is found). |
|
|
|
Re: update existing record
Posted: 03 Dec 08 8:19 AM
|
Mike, thanks for the response. I figured out what was going on last night: it wasn't an ADO issue as much as an anomoly of the date edit control. When I selected a date using the calander (control set to ddddd, DB field is Date), the update saved my change. If I typed "1/1/2009", the ADO .Update failed to save my change, but threw no error. To prevent this I am returning key = 0 for the key press event of these controls now.
The control isn't bound, and I am setting the fields("xxxxx").vqalue = dtemydate.datetime. If I try to set it equal to the .text property, ADO won't update.
Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?
Michael |
|
|
|
Re: update existing record
Posted: 04 Dec 08 7:13 AM
|
Originally posted by Michael Rogers
....
Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?
Michael |
|
You have run accross a "bug" that's been in the dte control since SP1 for 6.0 (which was when the control was added to SalesLogix). We created a function way back then (and still use it in every situation where dte is configured "date only") to deal with this problem. There's also a problem when you want "time only".
Here's a link to a bundle that has the "fix" for both problems. It includes typical usage info (tie to the OnPopupReturn event of the dte control(s).
www.rjlSystems.net/TheToolBoxX/Misc/DTE_Control_Fix.zip
-- RJLedger - www.SlxWizard.com rjlSystems |
|
|
|
Re: update existing record
Posted: 13 Dec 08 11:00 AM
|
you want the DATEONLY date time to store DATEVALUE(NOW()) & "00:00:05" otherwise you'll run into GMT/UTC conversion issues with SLX.
the 05 tells the provider NOT TO GMT CONVERT. |
|
|
|
Re: update existing record
Posted: 13 Dec 08 8:53 PM
|
Originally posted by RJ Samp
you want the DATEONLY date time to store DATEVALUE(NOW()) & "00:00:05" otherwise you'll run into GMT/UTC conversion issues with SLX.
the 05 tells the provider NOT TO GMT CONVERT. |
|
That's only related to "timeless" "Z" types and is not supposed to be used. If it's setup via teh dbmanager asa date Only it will not do a GMT/UTC conversion. -- RJLedger - www.SlxWizard.com rjlSystems |
|
|
|
Re: update existing record
Posted: 13 Dec 08 9:33 PM
|
I have ZERO Date fields in any Database in SLX for the last 11 years.....any/all versions.
When a DateTime field is , in actuality, a date only.....I've been using DATEVALUE(datetime) & " 00:00:05 " and all is fine......
How should we store a Date to Opportunity.DateOpened? Why doesn't SLX have this as a Date Field, why is it DateTime?
|
|
|
|
Re: update existing record
Posted: 19 Dec 08 10:07 PM
|
.....
Perhaps off-topic, but does anyone know how to force the date edit control to store 12:00:00, rather than current time if I have it configured as Date?
Michael |
|
There is a brutal way of forcing it, as exemplified in the following UPDATE statement (using Opportunity.EstimatedClose as an example)
update opportunity set estimatedclose = dateadd(hh, 12, cast(floor(cast(estimatedclose as real)) as datetime))
You could easily build something like this into your code.
Phil |
|
|
|
Re: update existing record
Posted: 20 Dec 08 8:37 AM
|
Originally posted by Phil Parkin
There is a brutal way of forcing it, as exemplified in the following UPDATE statement (using Opportunity.EstimatedClose as an example)
update opportunity set estimatedclose = dateadd(hh, 12, cast(floor(cast(estimatedclose as real)) as datetime))
You could easily build something like this into your code.
Phil |
|
Here's a link to a bundle that has a couple of basic functions to do what you want to do. You use these in the OnExit event of the DTE control: www.rjlSystems.net/TheToolBoxX/Misc/DTE_Control_Fix.zip
I wrote these a few years ago and have used them in 100% of the system we customize for our clients. -- RJLedger - www.SlxWizard.com rjlSystems |
|
|
|