Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment Variables

Status
Not open for further replies.

csiwa28

Programmer
Apr 12, 2001
177
I have a button on a form, and when it is clicked it will set an Environment Variable. Does anyone know if the Environment variable will be stored on the server or locally.
 
I believe it depends- What are you doing to set the Environmental Variable?
 
Well, I have 1 form with several fields that the user will fill in (e.g. Name, Address, Phone, etc). I also have a button on there that when clicked on, it will open up a new form, but this time those fields (Name, Address, Phone...)will have values in it already. Those values will be pulled from the previous document. I'm using environment variables to temporarily store them. The problem was that I didn't want to accidently have info from a previous doc because environment variables hold their values forever. I decided to just set/reset the environment variables before every use. This should take care of the problems whether it's stored on the server or local.
 
Here's something you might want to do without setting the Environmental variables.

Try setting up fields that Inherit values.
Set up the form that will inherit the values with the following:

In the FORM's properties, under the Defaults tab, check the "Formulas inherit values from selected document". The document you previously had open is actually considered the selected document.

For the fields that you want to inherit the values, set them up with "Compute when composed". And for their formula, put the previous document's field that you want to inherit from.

Here's the interesting thing, but can be confusing- the new form (I'll call a child form to make things simple, but it doesn't have to be a response document) can have fields with the same names, but those fields do NOT have to inherit the previous form's fields of that name. However They can!

For example-
The first form, has a Name field (I have to try to persuade you here- try to change it to a "last name" and "first name" fields- Name is often an object property and cause problems down the line if you decide to do some Object Progamming. The same goes for Date which is more often than not, a Forumla. There are many like this, but I degress)...

Okay, back to my example-
The first form has a field named "LastName". And you want the same field in your child form (2nd one composed). The child form ALSO has a "LastName" field, but it's Type is Compute when Composed, and it's formula is "LastName". You'd think at first glance that this was a recursive loop, but it's not- LastName in the formula IS refering to the previous document, not itself.

Okay, sometimes I'm not very clear, so if you didn't understand, let me know.

Also, depending on what the second form is doing however, it may be that you just want to use a DialogBox (for some great examples of this, check out the Buisness Cards form the Local Address book database. Use your own if you feel safe, or create a new one- then check out the buttons, and how it calls other forms, such as "(NameHelper)".)

I hope this helps you out without your needing to use the Environmental Variables.

-Mogryph
 
On the form that I have, I'm pulling information from 'Compute when composed' fields. I'm using environment variables to store what was in those fields, and depending on what was info was pulled, certain information will be displayed in those 'computed when composed' fields when the new form is opened up. Basically, I'm pulling information from one form, but what the new form will display depends on what was on the old form. If you could think of another way of doing this without environment variables, then please let me know. However, if not, I do want to thank you for trying to help me out.
 
I think I'm getting your drift, but-

You can also include, in Compute When Composed, a forumla that works off that old value from the previous form.

I'll just use a person's title for example:

First form has a field named "Gender" (using that word to avoid 1000+ hits to this page, ;-) ), which is a Computed when Composed field (not sure how we could compute when composed that field, but bare with me. hehe.)

Second form has a field named "Title", also a Computed when Composed field..
The Title field of the second form can have this in it's formula:
Code:
@If(Gender="M"; "Mr.";"F";"Ms.";"")

Hope that's what you're looking for. If not, let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top