alexliz Posted September 27, 2002 Posted September 27, 2002 Anybody has an idea on how I can make certain fields appear in place of others (ie on the same screen real estate) depending on the value in a certain key field? I have worked out some relationship which can make portals appear and disappear together with the fields they contain, but if I place one on top of the other, even if it's the one at the back of the screen to appear and the one at the front to disappear, the one at the back won't show. I have to place them side by side, which is a bit awkward, since the inactive portal looks like a waste of space. Thanks in advance!
CobaltSky Posted September 27, 2002 Posted September 27, 2002 It depends a little how you want users to interact with the layout. For example, I can suggest a method by which you achieve something like what you are requesting, but it will require that entry into the fields be mouse driven (ie the fields won't be able to be included in the tab order). If that suits your purposes, here is what you need to do to accomplish it. I'll assume for the purposes of this description that you have three different sets of fields which you want to appear in a particular place in your layout. In this example I'll assume that the sets are: Set 1 - Title, FirstName, MiddleName and LastName Set 2 - Gender, DateOfBirth, PlaceOfBirth and BirthCountry Set 3 - Address, City, State and ZipCode What you need to do is: 1. Create the data entry fields you wish to use (in this example there are twelve data entry fields). 2. Establish a method of controlling which group of four fields you want to appear (eg a global field called gSetSeletion with radio buttons assigned to it to select 'set 1, set 2 or set 3'). 3. Create four calculating fields of result type text, with formulae along the lines of: Case(gSetSeletion = "Set 1", "Title", gSetSeletion = "Set 2", "Gender", gSetSeletion = "Set 3", "Address"). One one to correspond to each of the four fields in the sets. 4. Create a further four calculations of result type text, along similar lines, but reference them to the actual fields (so they will pick up the field contents) rather than to literal text in quotes. The first one will be along the lines of: Case(gSetSeletion = "Set 1", Title, gSetSeletion = "Set 2", Gender, gSetSeletion = "Set 3", Address). Where the fields being referenced are date or time, you will need to include the approptiate conversion function (eg DateToText( )). 5. Create four scripts which references the cSetSelection global field along the lines of: If ["cSetSelection = "Title""] Go to Field [select, "Title"] If ["gFieldChoice = "Gender""] Go to Field [select, "Gender"] If ["gFieldChoice = "Address""] Go to Field [select, "Address"] 6. Place the four data entry fields from 'Set 1' on your layout beneath the gSetSelection radio button field, and place merge text fieldnames next to each of them with the merge text referenced to the corresponding calculation created in step 3. 7. After formatting the four fields appropriately, turn 'Allow Entry into field' off for all of them, then make three copies (so you'll have four sets in all). Attach the second set of four to the Set 2 fields, the third set of four to the Set 3 fields, and attach the last set to the corresponding calculations created in Step 4 (above). 8. Place (stack) the four sets of four fields precisely on top of one another, with the calculating fields frontmost. Make sure they all have the same fill color (and are not transparent). Position them appropriately on the layout with the radio button field and the merge text field names. 9. Attach the four scripts to the frontmost (calculating) fields - each to the 'stack' that they relate to. Now when you select a Set from the radio button field, the labels and visible contents of the fields will change to reflect those of the corresponding data entry fields. When you click on one of the fields (as though clicking to enter a field), the script will be invoked and will take you into the appropriate fiedl, forcing it to jump to the front. When you exit the field after editing, it will return to its position in the stack, but its contents will be displayed in the top (calc) field. The example I've described uses fields which are all from the same file, but the technique will work just as well using fields from related files, and can in fact be used for fields placed in a portal also if you wish If you want to have less fields in some sets than others, you will need a transparent masking container attached to a calculation field, which places a rectangle the same color as the background over the superfluous field(s) when a given set is selected. The main shortcoming is that the fields will always need to be the same size and in the same position (unless you want to go to some lengths with masking) but for most cases this is not too much of a drawback.
Recommended Posts
This topic is 8097 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now