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 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 once:
>
>
>
> CONFIRM(Current user+": Are you sure you want to approve these"+\
> String($selectedCount)+"records?";"Approve";"Don't Approve")
>
> If (OK=1)
>   For ($i;1;$selectedCount)
> [Approvals]approved_by:=Current user+" (4D Client)"
> [Approvals]approved_date:=Current date(*)
> [Approvals]notes:=[Approvals]notes+Char(13)+txtApprovalNotes
> [Approvals]log:=[Approvals]log+"4D client ("+Current user+") approved
> this record on"+\
> String(Current time(*))+" "+\
> String(Current date(*);" | Short")+Char(13)
> [Approvals];[Approvals]approved:=True
>
> SAVE RECORD([Approvals])
> NEXT RECORD([Approvals])
>   End for
> Else
>   ALERT("Operation canceled.")
> End if
>
>
>
>
>
>
>
> On Jul 3, 2018, at 4:00 PM, Noah via 4D_Tech <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
> **
>
>
>
**
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:4d_tech-unsubscr...@lists.4d.com
**

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 once:



CONFIRM(Current user+": Are you sure you want to approve these"+\
String($selectedCount)+"records?";"Approve";"Don't Approve")

If (OK=1)
  For ($i;1;$selectedCount)
[Approvals]approved_by:=Current user+" (4D Client)"
[Approvals]approved_date:=Current date(*)
[Approvals]notes:=[Approvals]notes+Char(13)+txtApprovalNotes
[Approvals]log:=[Approvals]log+"4D client ("+Current user+") approved this 
record on"+\
String(Current time(*))+" "+\
String(Current date(*);" | Short")+Char(13)
[Approvals];[Approvals]approved:=True

SAVE RECORD([Approvals])
NEXT RECORD([Approvals])
  End for 
Else 
  ALERT("Operation canceled.")
End if 







> On Jul 3, 2018, at 4:00 PM, Noah via 4D_Tech <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
> **

**
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:4d_tech-unsubscr...@lists.4d.com
**

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:
> 
> 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:4d_tech-unsubscr...@lists.4d.com
> **

_
Bob McKeever  http://www.mswl.com 
McKeever's Software Wizardry
Port Coquitlam, B.C.
bobmckee...@mac.com




**
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:4d_tech-unsubscr...@lists.4d.com
**

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) 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:4d_tech-unsubscr...@lists.4d.com
**

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([Approvals];[Approvals]APPROVED=FALSE)
SET QUERY DESTINATION(INTO VARIABLE;$APPROVED)
QUERY([Approvals];[Approvals]APPROVED=TRUE)
Now compare results
also if boolean is indexed, I might drop and then read that index, before 
running queries
regards
 chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

> On Jul 3, 2018, at 3:12 PM, Jeremy French via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> ALL RECORDS([Approvals])
> $count_all := Records in selection([Approvals])
> 
> QUERY([Approvals];[Approvals]approved=False)
> $count_query := Records in selection([Approvals])
> 
> Are the two counts equal?

**
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:4d_tech-unsubscr...@lists.4d.com
**

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_query := Records in selection([Approvals])

Are the two counts equal?


> On Jul 3, 2018, at 12:48 PM, Noah via 4D_Tech <4d_tech@lists.4d.com> wrote:
> 
> … 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.
> 
> QUERY([Approvals];[Approvals]approved=False)

**
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:4d_tech-unsubscr...@lists.4d.com
**

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 this to go through records
for ($loop; 1 records in selection[table]))
goto selected record (table;$loop)
lad record(table)
do stuff
save record([table])
unoad record ([table])
end for

On Tue, Jul 3, 2018 at 1:28 PM, Chip Scheide via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> 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:4d_tech-unsubscr...@lists.4d.com
> > **
> ---
> 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:4d_tech-unsubscr...@lists.4d.com
> **




-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
***

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 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:4d_tech-unsubscr...@lists.4d.com
> **
---
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:4d_tech-unsubscr...@lists.4d.com
**

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];[Approvals]approved=False)
> For ($vlRecord;1;Records in selection([Approvals])) // loop through the
> selection of Approvals
>// Do something with the record
>  SEND RECORD([Approvals]) // Save the record
>  NEXT RECORD([Approvals])   // Go to the next record
> End for
>
> Technically the First Record ([Approvals]) isn't needed as the query loads
> the first record.
>
>
> Neil
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Privacy Disclaimer: This message contains confidential information and is
> intended only for the named addressee. If you are not the named addressee
> you should not disseminate, distribute or copy this email. Please delete
> this email from your system and notify the sender immediately by replying
> to this email.  If you are not the intended recipient you are notified that
> disclosing, copying, distributing or taking any action in reliance on the
> contents of this information is strictly prohibited.
>
> The Alternative Investments division of UMB Fund Services provides a full
> range of services to hedge funds, funds of funds and private equity funds.
> Any tax advice in this communication is not intended to be used, and cannot
> be used, by a client or any other person or entity for the purpose of (a)
> avoiding penalties that may be imposed on any taxpayer or (b) promoting,
> marketing, or recommending to another party any matter addressed herein.
> **
> 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:4d_tech-unsubscr...@lists.4d.com
> **
>



-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**
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:4d_tech-unsubscr...@lists.4d.com
**

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 means there is no open serial port, which would be consistent 
with this problem as SET CHANNEL can be used to open either a port or a 
document.

If you are inquiring about looping over records, then can you give a bit 
more detail about what you are trying to do?  Certainly discovering the 
code was scanning the entire table instead of a selection is a shock.

best regards,


Bob Miller
Chomerics, a division of Parker Hannifin Corporation


ll
"PLEASE NOTE: The preceding information may be confidential or privileged. It 
only should be used or disseminated for the purpose of conducting business with 
Parker. If you are not an intended recipient, please notify the sender by 
replying to this message and then delete the information from your system. 
Thank you for your cooperation."
**
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:4d_tech-unsubscr...@lists.4d.com
**

RE: problems with SEND RECORD

2018-07-03 Thread Dennis, Neil via 4D_Tech
I just noticed you use send record instead of save record, that should work too 
as long as you have an open channel using Set Channel.

-Original Message-
From: 4D_Tech [mailto:4d_tech-boun...@lists.4d.com] On Behalf Of Dennis, Neil 
via 4D_Tech
Sent: Tuesday, July 03, 2018 10:55 AM
To: 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 sender. 

--
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
 SEND RECORD([Approvals]) // Send the record
 NEXT RECORD([Approvals])   // Go to the next record
End for

Technically the First Record ([Approvals]) isn't needed as the query loads the 
first record.


Neil






Privacy Disclaimer: This message contains confidential information and is 
intended only for the named addressee. If you are not the named addressee you 
should not disseminate, distribute or copy this email. Please delete this email 
from your system and notify the sender immediately by replying to this email.  
If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited.

The Alternative Investments division of UMB Fund Services provides a full range 
of services to hedge funds, funds of funds and private equity funds.  Any tax 
advice in this communication is not intended to be used, and cannot be used, by 
a client or any other person or entity for the purpose of (a) avoiding 
penalties that may be imposed on any taxpayer or (b) promoting, marketing, or 
recommending to another party any matter addressed herein.
**
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:4d_tech-unsubscr...@lists.4d.com
**

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
 SEND RECORD([Approvals]) // Save the record
 NEXT RECORD([Approvals])   // Go to the next record
End for

Technically the First Record ([Approvals]) isn't needed as the query loads the 
first record.


Neil














Privacy Disclaimer: This message contains confidential information and is 
intended only for the named addressee. If you are not the named addressee you 
should not disseminate, distribute or copy this email. Please delete this email 
from your system and notify the sender immediately by replying to this email.  
If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited.

The Alternative Investments division of UMB Fund Services provides a full range 
of services to hedge funds, funds of funds and private equity funds.  Any tax 
advice in this communication is not intended to be used, and cannot be used, by 
a client or any other person or entity for the purpose of (a) avoiding 
penalties that may be imposed on any taxpayer or (b) promoting, marketing, or 
recommending to another party any matter addressed herein.
**
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:4d_tech-unsubscr...@lists.4d.com
**