Page 1 of 1

ID accessible from valuelist field?

PostPosted: Wed Dec 28, 2011 4:41 am
by kedikatt
I use __sql__ = "select partID, Part from parts" as a valuelist. I choose from the list in the field PART. Can I now access and use the partID of the selected Part to use as a pointer to another field in that record that I wish to update? I will use a before save action.

Re: ID accessible from valuelist field?

PostPosted: Wed Dec 28, 2011 7:03 am
by Jean
Kedikatt,
Please clarify your question.
Jean

Re: ID accessible from valuelist field?

PostPosted: Thu Dec 29, 2011 5:10 am
by kedikatt
What I am wondering is, noticing that the sql to load the valuelist includes partID as an argument. Is partID also available to use, in for instance $record->val('partID')? Or is only the Part value returned as useable?
I have to ask instead of test it because I am not familiar enough with this application to easily write and test code to see if it is viable. Maybe it is not possible, maybe I would mess up the code, use the wrong functions, so I would not know if I could do it or not.
I think I have cobbled some code together to use it, if it is accessible.

Re: ID accessible from valuelist field?

PostPosted: Thu Dec 29, 2011 5:23 am
by Jean
Well, in fact in your list the id (partID) is the value and the value (partValue) is what is displayed in the list.
So the id is what is inserted into the database.
Hope this helps
Jean