Hi,
Apply to selection is not a command i use so cannot comment on that
except to say
if there are no other issues it seems a quick way to achieve your
goal here.
As you are 'teaching yourself 4d' here are some suggested changes
that may help you start to get used to 4d
-feel free for anyone else to chip in here -
correct me if i'm wrong but :
1/ i would put brackets around the Current date-90 to clearly
separate the execution order (this is more important if there are a
number of calculations on the rh side)
2. use [TABLE] field:= value in the loop to assign a value . MODIFY
SELECTION presents a list to be modified by the user (MODIFY RECORD
is a one record selection to be modified by user?)
3 use SAVE RECORD not ACCEPT (ACCEPT is again a 4d command used in
user selections with user forms rather than procedural code )
I would advise to look at the 4d examples on the web site
changed
ALL RECORDS([ProgNotes])
QUERY([ProgNotes];[ProgNotes]DOS>(Current date-90))
ORDER BY([ProgNotes];[Patients]NameLast;[Patients]NameFirst;
[ProgNotes]DOS;<)
For ($vlRecord;1;Records in selection([ProgNotes]))
[ProgNotes]LastVisit:=True
SAVE RECORD([ProgNotes]))
NEXT RECORD([ProgNotes])
End for
original
ALL RECORDS([ProgNotes])
QUERY([ProgNotes];[ProgNotes]DOS>Current date-90)
ORDER BY([ProgNotes];[Patients]NameLast;[Patients]NameFirst;
[ProgNotes]DOS;<)
For ($vlRecord;1;Records in selection([ProgNotes]))
MODIFY RECORD([ProgNotes];*)LastVisit:=True
ACCEPT
NEXT RECORD([ProgNotes])
End for
John
Sci-do communications
On 20 Apr 2008, at 15:59, <
gilliam@...> wrote:
>
> I continue to try to teach myself 4D. The following project method
> selects the records I want and puts them in order, but it does not
> do the next step: loop through the selection and assign "True" to
> the boolean field "LastVisit." Any suggestions would be appreciated.
>
> ALL RECORDS([ProgNotes])
> QUERY([ProgNotes];[ProgNotes]DOS>Current date-90)
> ORDER BY([ProgNotes];[Patients]NameLast;[Patients]NameFirst;
> [ProgNotes]DOS;<)
> For ($vlRecord;1;Records in selection([ProgNotes]))
> MODIFY RECORD([ProgNotes];*)LastVisit:=True
> ACCEPT
> NEXT RECORD([ProgNotes])
> End for
>
>
> **********************************************************************
> 4D Basics hosted by 4D, Inc.
http://www.4D.com/>
> An all-new List box. More features, more power.
> Headers, footers, cell formatting and other goodies.
> See it here first! <
http://www.4d.com/livedemos>
>
> To Unsubscribe: mailto:
4DBasics-off@...
> **********************************************************************
>
>
**********************************************************************
4D Basics hosted by 4D, Inc.
http://www.4D.com/An all-new List box. More features, more power.
Headers, footers, cell formatting and other goodies.
See it here first! <
http://www.4d.com/livedemos>
To Unsubscribe: mailto:
4DBasics-off@...
**********************************************************************