Re: Lookup values from a comma seperated field
Stan,
I have implemented your suggestion and it works just fine. I have modified your code pointers to match my database. As you will see i have a seperate table that holds the values for the lookup.
Unfortunately I have another problem with the maintainability of the values. If a user changes a value in tbl_diciplines, it does not change the lookup value in the current table. I have tried creating a new field that i could run as a calculated field and change the value say from .T. to .F. so that each record updates, but the lookup value remains unchanged.
If however, you change any value from any field within the record manually, the lookup value does change to the most recent value in tbl_diciplines.
Eg.
tbl_diciplines
01-Tea
02-Coffee
03-Bread
04_Milk
Current_Table
id--------location-------type------Tea
id--------location-------type------Coffee
id--------location-------type------Bread
If a user changes the descriptive value of Tea to Tee within tbl_disciplines the value in the current table does not change. If however, you update any part of the record in the current table for Tea, the lookup kicks in a changes the value to the new value.
Do you know the best way to maintain the accuracy of the data in the current table, should anyone change the values in the lookup table?
Thanks,
Denis
Stan,
I have implemented your suggestion and it works just fine. I have modified your code pointers to match my database. As you will see i have a seperate table that holds the values for the lookup.
Code:
tbl = table.current() strlist = tbl.AREA_DISCIPLINE_IDS tbl.AREA_DISCIPLINE = left(strtran(*for_each(foo,lookup("tbl_diciplines","dicipline_id = "+quote(foo),"alltrim(full_pj_desc)"),strtran(strlist,",",crlf())),crlf(),","),-1)
If however, you change any value from any field within the record manually, the lookup value does change to the most recent value in tbl_diciplines.
Eg.
tbl_diciplines
01-Tea
02-Coffee
03-Bread
04_Milk
Current_Table
id--------location-------type------Tea
id--------location-------type------Coffee
id--------location-------type------Bread
If a user changes the descriptive value of Tea to Tee within tbl_disciplines the value in the current table does not change. If however, you update any part of the record in the current table for Tea, the lookup kicks in a changes the value to the new value.
Do you know the best way to maintain the accuracy of the data in the current table, should anyone change the values in the lookup table?
Thanks,
Denis
Comment