Re: problems with SEND RECORD

2018-07-03 Thread Noah via 4D_Tech
Many thanks, that was a silly oversight, explicitly saving to and moving to the next record in the Approvals table fixes the problem. I appreciate the suggestions for more efficient code! On Tue, Jul 3, 2018 at 3:52 PM npdennis wrote: > > > // THIS DOESN'T work! it approves the records but does

Re: problems with SEND RECORD

2018-07-03 Thread npdennis via 4D_Tech
> // THIS DOESN'T work! it approves the records but does append to the log Try this loop instead, you need a save record in the loop, and since you are saving each you don’t need the apply to selection and first record… the loop below will take less execution time and only modify the records

Re: problems with SEND RECORD

2018-07-03 Thread Robert McKeever via 4D_Tech
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 <4d_tech@lists.4d.com> wrote: >

Re: problems with SEND RECORD

2018-07-03 Thread Noah via 4D_Tech
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) w

Re: problems with SEND RECORD

2018-07-03 Thread Chuck Miller via 4D_Tech
OK If you are going to do this, why not go all the way C_LonGINT($RECORDSINTABLE;$ALLRECORDS;$NOTAPPROVED;$APPROVED) $RECORDSINTABLE:=RECORDS IN TABLE([Approvals]) > ALL RECORDS([Approvals]) > ALLRECORDS:= Records in selection([Approvals]) SET QUERY DESTINATION(INTO VARIABLE;$NOTAPPROVED) QUERY([A

Re: problems with SEND RECORD

2018-07-03 Thread Jeremy French via 4D_Tech
Since you encountering more records than expected, do all records in the table “Approval” have False assigned assigned to the field “approved”? Try this in your method: ALL RECORDS([Approvals]) $count_all := Records in selection([Approvals]) QUERY([Approvals];[Approvals]approved=False) $count_q

Re: problems with SEND RECORD

2018-07-03 Thread Charles Miller via 4D_Tech
There are other issues with this loop. You must for example make sure record is loaded and table is set to read/write. before doing something. I have seen code where programnmer didn’t load record and it was locked somewhere else. Thios causes all types of problems. I always for my for loops like

Re: problems with SEND RECORD

2018-07-03 Thread Chip Scheide via 4D_Tech
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

Re: problems with SEND RECORD

2018-07-03 Thread Charles Miller via 4D_Tech
did you use open channel before the send record Regards Chuck On Tue, Jul 3, 2018 at 12:54 PM, Dennis, Neil via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Not sure what your question is... this loops through all [Approvals] > records that have [Approvals]Approved = false > > QUERY([Approvals];[App

Re: problems with SEND RECORD

2018-07-03 Thread Bob Miller via 4D_Tech
Hi Noah, I'm not clear if your question regards SEND RECORD or, "Am I missing something in my understanding of looping over records?" Regarding SEND RECORD, the example in the documentation isn't complete, you first have to set up a destination for the record using SET CHANNEL. An error -28 me

RE: problems with SEND RECORD

2018-07-03 Thread Dennis, Neil via 4D_Tech
: supp...@gus.ucsb.edu; 4D iNug Technical <4d_tech@lists.4d.com> Cc: Dennis, Neil Subject: RE: problems with SEND RECORD This is an EXTERNAL email. Do not open attachments or click on links unless you have confirmed the identity of the

RE: problems with SEND RECORD

2018-07-03 Thread Dennis, Neil via 4D_Tech
Not sure what your question is... this loops through all [Approvals] records that have [Approvals]Approved = false QUERY([Approvals];[Approvals]approved=False) For ($vlRecord;1;Records in selection([Approvals])) // loop through the selection of Approvals // Do something with the record

problems with SEND RECORD

2018-07-03 Thread Noah via 4D_Tech
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 recomm