View Full Version : Accessing Field Rules via WAS?


10-18-2004, 05:25 PM
Using the WAS I have created a dropdown that has a lookup from a different table. Upon selecting the appropriate record, I want to fill in two additional fields from the same lookup table.

In native A5, this is easily accomplised using field rules. Is there a way to accomplish the same functionality using the WAS in conjunction with native A5?

Thanks in advance

Jim Seidel

Selwyn Rabins
10-20-2004, 06:02 AM
you would have to write code in the canSaveRecord event to fill in the values in the other fields.

however, even though Field Rules in a5 allow you to do lookups and then fill in other fields, it really breaks the rules of relational databases to do this. why do you need to store the related values in the table when they can be referenced from the lookup table at any time you need them?

Pat Bremkamp
10-20-2004, 08:24 AM

If I understand your question correctly, this is easy to do in a dialog component.

I have a dialog component which is a single dropdown box. The setup for the box is shown in the attached picture. The dropdown displays two fields from the table and loads three fields from the table into the single variable 'vLN'

Then, in the AfterValidate event, I have the following code that parses the variable into separate session variables. You could just as easily save them into a table using table.enter_begin() or table.change_begin().

In my testing, the fields are loaded into the variable at the length defined in the table structure, so you'll always know the field length.



Pat Bremkamp
10-20-2004, 08:28 AM

This is what the dropdown box looks like.


10-20-2004, 10:56 AM
"why do you need to store the related values in the table when they can be referenced from the lookup table at any time you need them?"

Two reasons:

1) we need to index on them and
2) we have (3) fields that reference the same table (we call them Notify_1, Notify_2 and Notify_3). All 3 reference the same field in the contact table

10-20-2004, 10:58 AM
Here's a picture of the information

10-20-2004, 11:07 AM
Here's a picture of the information:

Note, if you click on the edit button, next to the corresponding name it will pulls up the corresponding record detail from the Contact table.

What I want the WAS to do is display the corresponding e-mail and contact info from the contact table. When this page is generated. That way we only need to change the Name and the rest of the data will be automatically populated. Like I indicated previously, we are doing this without any hitches in native A5, but I can't figure out how to do it in the WAS

02-22-2005, 03:52 AM
I guess the question would not be why you want this option to be available while you can reference to it, but in my opinion the question should be why this functionality is not available in the Grid Component although it is available in the field rules.

Now you can not -using RAD- build up your grid components in a similar way as you did your tables.

It would be highly recommended if this feature was added anyway.

Kind regards,


02-22-2005, 06:01 AM
One thing you may also want to consider here is performance.

There would be 3 ways Alpha would have do this:
1. Include some kind of hidden array with the possible values for the other 2 fields. Then include a java script that would search the array for the matching values and then populate the other 2 other inputs with the appropriate values. If this the select list gets too long it could significantly slow down the load of the page.

2. Do a post back once you select the contact. This requires a round trip to the server to retrieve the matching values from the server and re-displays the page with the selected data. This is very much like the cascading drop downs example in the demo. The performance hit here is the round trip.

3. Code the component to "know" that is a multiple field lookup. This is a variation of what Pat is talking about above. The page only displays the contact lookup. The user selects the lookup item. The form is posted back to the server. The server then adds the matching values to the data base. There little performance hit using this solution.

In the meantime, any of these solutions you can code yourself...

John Bowen
alpha 5 hosting

02-22-2005, 07:23 AM
John / Marcel -

THanks for the replys. We ended up solving the problem using Suggestion #1. It took a long time to figure it out, but it works fine. On a side note, initially we built all of our A5 related web pages with grids and also got fairly elaborate using the freeform template. Although this worked, there was definitely a performance hit as we added dropdowns, look up etc.

Where we sit now, we have several pages that are still A5W with grids, but it they get complex we write them in HTML, Hava and call the server directly. THe performance is awesome.