Re: Set text field to a certain value using a script -FM 8
- From: Helpful Harry <helpful_harry@xxxxxxxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 16:24:13 +1300
In article
<3465b116-824b-4a7c-b0e0-cce99ec5ad95@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Deepti <dpulavarthi@xxxxxxxxx> wrote:
On Feb 27, 3:01 pm, Helpful Harry <helpful_ha...@xxxxxxxxxxxxxxxx>
wrote:
In article
<0ad8e869-a410-448e-b2f2-5976f062e...@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Deepti<dpulavar...@xxxxxxxxx> wrote:
Hello All,
I have a layout which has a text field called "City". I have a hidden
field called "Mutiple City".
Each time the field contents of City ="new york" I need to set the
hidden field to "true".
Could you please guide me on how I could do this?
If this is the only thing that the Multiple City field does, then you
don't want a script ... what you need to do is make Multiple City a
Calculation field which tests the contents of the City field and
calculates the appropriate result.
For testing fields you need the If or Case statement. It doesn't really
matter which you use when there's only a "single" test with two
possible results.
This means you field would be:
Multiple City Calculation, Text Result, Unstored,
= If (City = "New York"; "True"; "False")
This says: If the data in the City field is "New York" then set
Multiple City to "True", otherwise set Multiple City to "False".
Now presumably there are other cities that will also need Multiple City
set to "True", and this is where the "or" operator for tests comes in.
You can use "or" to string multiple tests together when they all have
the same result.
eg.
Multiple City Calculation, Text Result, Unstored
= If ( (City = "New York") or (City = "Los Angeles");
"True"; "False")
Which says: If the data in the City field is "New York" or is "Los
Angeles" then set Multiple City to "True", otherwise set Multiple City
to "False".
You can continue to add as many cities as you need using the "or"
operator, making sure each sub-part of this "single" test has it's own
set of brackets / parentheses.
WOW! that works great! thanks a ton but I have another bit to do
here....
in case the data in the city field is "New york" it has to say "new
york" in the multiple field and if its "Los Angeles" then I need it to
say multiple city field to say "los angeles" or something unique for
each city.
Should I use the case loop???
Why would you want such a field?? You already have the name of the city
in the City field. There may be a better way to do what you're trying
to achieve. (It's also often not a good idea to 'hardcode' the city
names into Calculations like this since it makes the dtabase more
difficult to change if the city names later need to be altered.)
If you really need it, then it can be done with an If or Case statement
something like:
Multiple City Calculation, Text Result, Unstored
= If ( (City = "New York") or (City = "Los Angeles");
City; "")
which says: If the Data in the City field is "New York" or "Los
Angeles" then copy that data to Multiple City, otherwise leave the
Multiple City field empty (ie. "" means empty / nothing).
You can again add more cities using the "or" operator.
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
.
- References:
- Set text field to a certain value using a script -FM 8
- From: Deepti
- Re: Set text field to a certain value using a script -FM 8
- From: Helpful Harry
- Re: Set text field to a certain value using a script -FM 8
- From: Deepti
- Set text field to a certain value using a script -FM 8
- Prev by Date: Re: Find in a date range
- Next by Date: Re: Find in a date range
- Previous by thread: Re: Set text field to a certain value using a script -FM 8
- Next by thread: Specifying onscreen record when printing
- Index(es):
Relevant Pages
|