as noted elsewhere:
for Send Record to do anything (and not give the error your have 
mentioned) you have to have opened/created a file on disk with Set 
Channel.

However, it is possible that there was a typo somewhere, and what you 
are trying to do is to manipulate the record (do something with the 
record)
and then SAVE the change(s).  In that case, you are using the wrong 
command, and instead of Send Record, you should be using Save Record.
Save Record will save, whatever changes to the record data occurred 
during the // Do something with the record part of the code.


QUERY([Approvals];[Approvals]approved=False)

 // loop through the selection of Approvals
For ($vlRecord;1;Records in selection([Approvals]))
             // Do something with the record

     SAVE RECORD([Approvals])    // Save the record <----

     NEXT RECORD([Approvals])   // Go to the next record
End for


On Tue, 3 Jul 2018 09:48:08 -0700, Noah via 4D_Tech wrote:
> Good morning!
> I work with a large codebase that has had many developers over the years.
> Consequently, when building something new, I will sometimes look to see how
> something was done previously. More often it has been the case that I will
> go straight to the documentation to see the currently recommended 4D
> approach to the issue.
> 
> Today I was looking at capturing the 'approval of selected records'.
> Selected is a boolean value in the database. Stepping through the code I
> could see that where we were supposed to be looping over the records in the
> current selection, we were instead dealing with the whole selection.
> Stepping back from the context of the application, I created a scratchpad
> sort of method, which contains a simple query and a code snippet directly
> from the documentation.
> 
> The 4th basic example in on this page:
> http://doc.4d.com/4Dv15/4D/15.6/ForEnd-for.300-3818649.en.html produces an
> -28 communication error after trying to SEND RECORD.
> 
> 
> QUERY([Approvals];[Approvals]approved=False)
> 
> 
> FIRST RECORD([Approvals])
> 
> For ($vlRecord;1;Records in selection([Approvals]))
> 
>   // Do something with the record
> 
> SEND RECORD([Approvals])
> 
>   // ...
> 
>   // Go to the next record
> 
> NEXT RECORD([Approvals])
> 
> End for
> 
> 
> Am I missing something in my understanding of looping over records?
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to