Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying value other than controlsource in grid
Message
 
 
To
08/02/1999 16:10:03
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00185208
Message ID:
00185278
Views:
29
>>>>>I think that sparse property should do this. Also, there is really another way to do this job:
>>>>
>>>>Sparse shows the boundcolumn, which is the surrogate key. I don't want to display the surrogate key.
>>>>
>>>>I want to change the key value, but display the discriptive value.
>>>
>>>Would you like to get right-click menu way? I don't mean that first way doesn't work. It does, but troubleshooting might be painful, espacially on-online (also I don't have VFP on-hand right now :).
>>
>>Give me the gist of the shortcut menu way? I am interested.
>
>It includes two parts:
>1) Displaying field in grid from ahother table.
>2) Getting this field 'edited' directly in grid.
>Part 1.
>Let say you have master and lookup table. One of master table field is foreign key (surrogate integer) from lookup table, e.g. "lookup_id". You set programmatically some
>Grid.Column.Controlsource="''+getlookupdescription(mycursor.lookup_id)"
>Here 'getlookupdescription' is system function (it can be also some object custom method, etc) which will return Lookup.description field:
>Function GetLookupDescription
>LParameter nId
>IF SEEK(nId,"lookup","id")=.T.
>RETURN Lookup.Description
>ELSE
>RETURN "Unknown"
>ENDIF
>
>Try it, and if it's Ok, we can proceed to part 2.

I didn't think to use a function to do the lookup in the controlsource. What will the value of the column be when you leave this column/record? If you return the LookupDescription, will that not be the value of the record, not the key. I will have to play with this.

John's suggestion maybe the easiest to implement at this point. I am going to give it a try.

Thanks again for the assistance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform