You need to save each record:

[Approvals]log:=$new_line+$current_log
SAVE RECORD([Approvals])
NEXT RECORD

and, of note, just a bare NEXT RECORD command assume that [Approvals] is the 
default table. It might not be.

> On Jul 3, 2018, at 3:00 PM, Noah via 4D_Tech <[email protected]> wrote:
> 
> Thank you all for the quick feedback!
> 
> The approvals table has all records with Approved defaulting to False.
> The problem was with not including Set Channel (which is not really what I
> wanted to be doing anyways). I must have taken a fork in the road (while
> reading the documentation this morning) which lead to a place I should not
> have been.
> 
> First problem was that looping over records in selection was not limiting
> it to one record inside the loop.
> 
> http://doc.4d.com/4Dv15/4D/15.6/Records-in-selection.301-3817584.en.html
> 
> When I tried an alternate approach, I ended up looking at sockets
> 
> Here is a snippet from the original code that I was trying to get working:
> 
> CONFIRM(Current user+": Are you sure you want to approve these
> "+String($selectedCount)+" records?";"Approve";"Don't Approve")
> 
> If (OK=1)
> APPLY TO SELECTION([Approvals];[Approvals]approved:=True)
> 
> FIRST RECORD([Approvals])
> 
>  // THIS DOESN'T work! it approves the records but does append to the log
> of each record
> For ($i;1;$selectedCount)
>  [Approvals]approved_by:=Current user+" (4D Client)"
>  [Approvals]approved_date:=Current date(*)
> 
>  $current_notes:=[Approvals]notes
>  [Approvals]notes:=$current_notes+Char(13)+txtApprovalNotes
> 
>  $sTime_Stamp:=String(Current time(*))+" "+String(Current date(*);"|Short")
>  $new_line:="4D client ("+Current user+") approved this record on
> "+$sTime_Stamp+Char(13)
>  $current_log:=[Approvals]log
>  [Approvals]log:=$new_line+$current_log
>  NEXT RECORD
> End for
> Else
> ALERT("Operation canceled.")
> End if
> 
> 
> txtApprovalNotes is the name of a text entry field on the form.
> **********************************************************************
> 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]
> **********************************************************************

_________________________________________
Bob McKeever                      http://www.mswl.com <http://www.mswl.com/>
McKeever's Software Wizardry
Port Coquitlam, B.C.
[email protected]




**********************************************************************
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