Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lookups
Message
 
 
To
19/12/2001 03:34:12
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Miscellaneous
Thread ID:
00595992
Message ID:
00596084
Views:
26
>Oh boy do I feel like a fish out of water! I've been coding in Fox for many years and now while trying to learn the MM framework, I'm resorting to asking really stupid questions!
>
>Here are 2 more:
>
>1. I want to do a simple lookup into another table from the 2nd page on a bizObjMaintenanceForm. I add a bizobj based on a view that includes the 2 fields I want in my lookup combobox. I make sure this object is the first in tab order on the page. Its not the primary bizobj. The combobox references the v_ view that is in the bizobj. When I run the form, there's nothing in the box! Grrrrrrrr.

The values of the following properties should be similar to:

BoundColumn = 3
BoundTo = .T. && if BoundColumn data type is numeric
ControlSource = 'other_table_or_view.field'
RowSourceType = 6
RowSource = 'v_view.field1, field2, keyfield'
ColumnWidths = '123, 321, 0'
ColumnCount = 3

From VFP Help on BoundTo set to FALSE --

If the variable or field specified in the ControlSource property setting is of numeric type, the Value property uses the index number from the ListIndex property.

Now why anyone would want the ListIndex value of the Combo stored as the value in the ControlSource is beyond my comprehension because that value could change the next time the combo is populated with values especially if new choices have been added. Just looking at the Help on this topic, I would default BoundTo to TRUE regardless of the data type.

In the example I gave, the value in column 3 of the combo will always be the value used for storing in the ControlSource. Some people prefer to store the actual description or code in the ControlSource. I prefer to store the Primary Key of the record in the Lookup table in the ControlSource. That way, if I change the code or description in the Lookup table, all records in the ControlSource table that have that FK reference now reflect the new code or description.

There are solid reasons for storing the actual code or desc in the ControlSource table instead of the FK value. The major one being the code or description needs to remain unchanged and reflect the values at the time of the transaction. If that is your case, then the following properties would look something like:

BoundColumn = 1 && or 2
BoundTo = .T. && if BoundColumn data type is numeric
ControlSource = 'other_table_or_view.field'
RowSourceType = 6
RowSource = 'v_view.field1, field2'
ColumnWidths = '123, 321'
ColumnCount = 2

>2. Same problem with a grid on a page. I'm using cGridList. Is this the one to use?

Again, look at the values for your RecordSource [should be a table or view]. Then look at the ControlSource for each of the grid columns. If you use -1 for the ColumnCount, then the ControlSource for each column is irrelevant.

Finally, make sure your tables and views are being opened either in the DataEnvironment of the form or at least in the Load method of the form.


>Time to call it a night (3:20am) and ditch the chance to show the system tomorrow. Thanks much for any help!
>
>Sally
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform