Normal Topic Cannot write to current record that is in called X (Read 2214 times)
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Cannot write to current record that is in called X
Mar 26th, 2019 at 12:25am
Print Post Print Post  
I am calling an XResultSet where all records have same ActionDate as the current record.  The count is four records; that is this record, plus three other records.   Sort records in Ascending Time  to update some Running Totals calculations in proper time sequence.  Math is sequential, using values from previous record.  Calculations work correctly but the ten fields in the current record do not get updated.  Because the last calcs are variables, the math on the following records is done correctly and written to correctlycorrectly to them. No difference if current record is first, last, or a middle record in the sort.

How can I write the correct Running Totals to the current record when the loop counter calls up the current record?  Is there some type of UnlockRecord command I have missed?

I just found an old posting from Ray in 2014 that mentions a command XResultSetOpenForm.   I find nothing in the Programming Guide.   Is this what I am looking for?  If Yes, can you please show sample code of how to use this in my situation?

Thanks for listening.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Cannot write to current record that is in called X
Reply #1 - Mar 26th, 2019 at 12:56am
Print Post Print Post  
The XResultSetOpenForm is documented in the errata file.  My copy is noted for Version 2. 5. 3,  January 2015.  Here is an excerpt:

Code
Select All
XResultSetOpenForm(rs, form_name)
Type: External Database Application Management
Parameters: rs as int, form_name as string
Returns: Nothing
This command opens the specified form in Update mode with records pre-retrieved.
This function accepts two arguments:
The handle for the result set to use - This must be a result set from a database in the current file. If using
@XResultSetSearch, specify @FN as the first argument. You cannot use this command to open forms in other db or
dsr files.
The name of the form to open - The specified form must be a form attached to the same database as the one from
which the result set records were retrieved.    



I have never used this, cannot help you here.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Cannot write to current record that is in called X
Reply #2 - Mar 26th, 2019 at 1:56pm
Print Post Print Post  
You cannot use the X commands to modify the record that you currently have open. If the times on the records are unique you can compare the X value of time of the record in the loop to the time stored in the element on the form. If they are the same use element names to update values. Otherwise use the X commands

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Cannot write to current record that is in called X
Reply #3 - Mar 26th, 2019 at 8:14pm
Print Post Print Post  
Writing directly to the record vs. the RecordSet does it.  I found the @XResultSetLocked(vRS) command and was surprised that the current real record in the RecordSet was not locked, none of them were, but after your note, I thought it would be. 

But anyway, I checked to see if the unique RecordNumber matched, and used the direct method that worked fine.

Good note to include in documentation re unable to write to initial record.  It is tougher to troubleshoot when the RecordSet Count is one, and the initial record is the only record in the RecordSet.  Looks like the actions are not happening at all.

Thanks for the suggestion.
  
Back to top
 
IP Logged