Re: Set text field to a certain value using a script -FM 8



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



Relevant Pages

  • Re: How do I include an attachment to mail merged email?
    ... The code in the macro does rely on the catalog merge producing a table, ... to be in the cells of a table. ... So for a record that has Houston as the city, ... If there was no entry in the city field, ...
    (microsoft.public.word.mailmerge.fields)
  • Re: How do I include an attachment to mail merged email?
    ... > to be in the cells of a table. ... > So for a record that has Houston as the city, ... > If there was no entry in the city field, ... > Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: set up two criteria in one command button
    ... Base your other form on a query that contains a City field and State field. ... Put the following in the criteria of the State field: ... > on the form, I set up a "Search" button, which is a command button. ...
    (comp.databases.ms-access)
  • Re: Visitor data input form
    ... > to enter the state on the input form and have the cities in that state ... > selected to be available in the city field. ... > TN to pick from where I could select Paris. ...
    (microsoft.public.access.forms)
  • Re: Set text field to a certain value using a script -FM 8
    ... I have a layout which has a text field called "City". ... If this is the only thing that the Multiple City field does, ... Now presumably there are other cities that will also need Multiple City ... Angeles" then set Multiple City to "True", ...
    (comp.databases.filemaker)