Re: method to assign values to a field

View: New views
7 Messages — Rating Filter:   Alert me  

Re: method to assign values to a field

by Gilliam Johnston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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



Parent Message unknown Re: method to assign values to a field

by softmartin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gilliam,

try using the command " apply to selection"

ALL RECORDS([ProgNotes])
QUERY([ProgNotes];[ProgNotes]DOS>Current date-90)
ORDER BY([ProgNotes];[Patients]NameLast;[Patients]NameFirst;
[ProgNotes]DOS;<)
APPLY TO SELECTION([ProgNotes];LastVisit:=True)

HTH
  Martin
**********************************************************************
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@...
**********************************************************************



Re: method to assign values to a field

by john convey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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



Re: method to assign values to a field

by softmartin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gilliam,
an unwanted semicolon crept in; I think that the last line should be

APPLY TO SELECTION([ProgNotes]LastVisit:=True)

HTH
Martin

Begin forwarded message:

> From: softmartin@...
> Date: April 20, 2008 6:53:14 PM GMT+01:00
> To: 4D Basics List <4DBasics@...>
> Subject: Re: method to assign values to a field
> Reply-To: 4D Basics List <4DBasics@...>
>
> Gilliam,
>
> try using the command " apply to selection"
>
> ALL RECORDS([ProgNotes])
> QUERY([ProgNotes];[ProgNotes]DOS>Current date-90)
> ORDER BY([ProgNotes];[Patients]NameLast;[Patients]NameFirst;
> [ProgNotes]DOS;<)
> APPLY TO SELECTION([ProgNotes];LastVisit:=True)
>
> HTH
> Martin
> **********************************************************************
> 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@...
**********************************************************************



Re: method to assign values to a field

by Allen Matlick-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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)

A minor comment.  You don't need to use the ALL RECORDS([ProgNotes])
line.  The QUERY command automatically works on all of the records in
the table referred to.

In contrast the QUERY SELECTION command works on the currently selected
records.  If you use QUERY SELECTION the ALL RECORDS command would not
be redundant.

Allen




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



Parent Message unknown Re: method to assign values to a field

by Gilliam Johnston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks. That's helpful, and I need all the help I can get.
(I'm not sure about the etiquette of the ListServe: do I thank people individually or on the list?)
Gilliam
--
My new e-mail address is gilliam@.... The "From" box may continue to read gilliam@... until Time-Warner learns how to use the technology they've acquired.

---- Allen Matlick  wrote:

=============
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)

A minor comment. You don't need to use the ALL RECORDS([ProgNotes])
line. The QUERY command automatically works on all of the records in
the table referred to.

In contrast the QUERY SELECTION command works on the currently selected
records. If you use QUERY SELECTION the ALL RECORDS command would not
be redundant.

Allen




> 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! /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! /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@...
**********************************************************************



Re: method to assign values to a field

by Allen Matlick-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

gilliam@... wrote:
> Thanks. That's helpful, and I need all the help I can get.
> (I'm not sure about the etiquette of the ListServe: do I thank people individually or on the list?)
> Gilliam

I don't know.  I've seen both.

Allen



> --
> My new e-mail address is gilliam@.... The "From" box may continue to read gilliam@... until Time-Warner learns how to use the technology they've acquired.
>
> ---- Allen Matlick  wrote:
>
> =============
> 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)
>
> A minor comment. You don't need to use the ALL RECORDS([ProgNotes])
> line. The QUERY command automatically works on all of the records in
> the table referred to.
>
> In contrast the QUERY SELECTION command works on the currently selected
> records. If you use QUERY SELECTION the ALL RECORDS command would not
> be redundant.
>
> Allen
>
>
>
>
>> 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! /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! /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@...
> **********************************************************************
>
>


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