dbTalk Databases Forums  

calculating field name

comp.databases.filemaker comp.databases.filemaker


Discuss calculating field name in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rich Sagall
 
Posts: n/a

Default calculating field name - 12-30-2006 , 07:17 PM






I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know
how to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich

Reply With Quote
  #2  
Old   
Matt Wills
 
Posts: n/a

Default Re: calculating field name - 12-30-2006 , 07:58 PM






There's no using a calculation to tell FM which field to act on or go to.

Any script step you could use to effect a change in the value of a field requires specifying the field directly in the dialog.

Thus, it's nothing but brute force scripting:

If [ Month ( Get ( CurrentDate ) ) = 1 ]

Set Field [ SomeTable::M1 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 2 ]

Set Field [ SomeTable::M2 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 3 ]

Set Field [ SomeTable::M3 [ "No" ] ]

etc., etc., etc.

End If

Clunky, but it will do the job.

Matt


On 12/30/2006 20:17:03 rich.sagall (AT) pobox (DOT) com (Rich Sagall) wrote:

Quote:
I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know how
to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich

Reply With Quote
  #3  
Old   
Rich Sagall
 
Posts: n/a

Default Re: calculating field name - 12-30-2006 , 08:06 PM



That's what I was afraid of.

Thanks

Matt Wills <Im (AT) witz (DOT) end> wrote:

Quote:
There's no using a calculation to tell FM which field to act on or go to.

Any script step you could use to effect a change in the value of a field
requires specifying the field directly in the dialog.

Thus, it's nothing but brute force scripting:

If [ Month ( Get ( CurrentDate ) ) = 1 ]

Set Field [ SomeTable::M1 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 2 ]

Set Field [ SomeTable::M2 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 3 ]

Set Field [ SomeTable::M3 [ "No" ] ]

etc., etc., etc.

End If

Clunky, but it will do the job.

Matt


On 12/30/2006 20:17:03 rich.sagall (AT) pobox (DOT) com (Rich Sagall) wrote:

I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know
how to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich

Reply With Quote
  #4  
Old   
Matt Wills
 
Posts: n/a

Default Re: calculating field name - 12-30-2006 , 08:15 PM



Every once in a while, you have to rough it. Not everything can be done "elegantly."

In the end, it's just a few more script steps than you were hoping for, and most of it can be accomplished through duplicating or copy/paste. Running such a short script once a month is not going to slow anything down.

M

On 12/30/2006 21:06:23 rich.sagall (AT) pobox (DOT) com (Rich Sagall) wrote:

Quote:
That's what I was afraid of.

Thanks

Matt Wills <Im (AT) witz (DOT) end> wrote:

There's no using a calculation to tell FM which field to act on or go to.

Any script step you could use to effect a change in the value of a field
requires specifying the field directly in the dialog.

Thus, it's nothing but brute force scripting:

If [ Month ( Get ( CurrentDate ) ) = 1 ]

Set Field [ SomeTable::M1 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 2 ]

Set Field [ SomeTable::M2 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 3 ]

Set Field [ SomeTable::M3 [ "No" ] ]

etc., etc., etc.

End If

Clunky, but it will do the job.

Matt

On 12/30/2006 20:17:03 rich.sagall (AT) pobox (DOT) com (Rich Sagall) wrote:

I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know
how to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich

Reply With Quote
  #5  
Old   
Bill
 
Posts: n/a

Default Re: calculating field name - 12-30-2006 , 09:41 PM



In article <12302058.YQRVSUFF (AT) news (DOT) verizon.net>,
Matt Wills <Im (AT) witz (DOT) end> wrote:

Quote:
There's no using a calculation to tell FM which field to act on or go to.

Any script step you could use to effect a change in the value of a field
requires specifying the field directly in the dialog.

Thus, it's nothing but brute force scripting:

If [ Month ( Get ( CurrentDate ) ) = 1 ]

Set Field [ SomeTable::M1 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 2 ]

Set Field [ SomeTable::M2 [ "No" ] ]

Else If [ Month ( Get ( CurrentDate ) ) = 3 ]

Set Field [ SomeTable::M3 [ "No" ] ]

etc., etc., etc.

End If

Clunky, but it will do the job.

Matt


On 12/30/2006 20:17:03 rich.sagall (AT) pobox (DOT) com (Rich Sagall) wrote:

I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know how
to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich
There is another approach that uses calculations.

Define a number field "ThisMonth" and a script that does:

Set Field [ThisMonth = Month(Get(CurrentDate))]

Define the individual month fields as calculation fields with text
result:

m01 : if(ThisMonth = 1;"No";"")
m02 : If(ThisMonth = 2;"No";"")
and so on

--
For email, change <fake> to <earthlink>
Bill Collins


Reply With Quote
  #6  
Old   
Old Foggy
 
Posts: n/a

Default Re: calculating field name - 12-30-2006 , 09:44 PM



Having to change 1 field's contents to "no" implies
another month field has to be changed to "yes"
I would just open the database - make sure it shows all records
and just change the necessary first record field to either "no" or "yes"
as the case may be and then use "replace all records"

Gus

"Rich Sagall" <rich.sagall (AT) pobox (DOT) com> wrote

Quote:
I have a solution with fields m01, m02,...m12. Each fields contains
either "Yes" or "No."

Every month I need to change the field for that month (i.e. m12 for
December) to "No."

I want a script that I can run at the beginning of each month to
automatically do this.

I can calculate the field name for the current month, but I don't know
how to use it as the field name I want to change.

I hope this makes sense.

Thanks,

Rich



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.