michaelk Posted September 3, 2011 Share Posted September 3, 2011 Is it possible to get the handle of a parametric object with a known (and hopefully unique!) record field value? i.e., GetItem(Record Name, Field Value, returnedHandle); thanks mk Quote Link to comment
ccroft Posted September 4, 2011 Share Posted September 4, 2011 I'd try one of the ForEach calls with something very similar to the example in function reference under GetRField that said "IF GetRField = FieldValueMeLookFor THEN HandleToObjectMeLookFor := H". If you used ForEachObject you could restrict the number of objects queried with some sort of Criteria filter. Possibly by PIO name, since if you know the value you're looking for you probably also know the name of the object it's attached to. The 'record' parameter in GetRField(h,record,field) is the PIO's name, and field name is... well usually it's the name of the field you see in OIP. I haven't been around much lately so there's a pretty good chance I've forgotten something, but there's plenty of other posters who'll know this routine. Hopefully they're enjoying a lovely Labour Day weekend. Just thought I'd give you something to start with until one of them comes along. Quote Link to comment
Pat Stanford Posted September 4, 2011 Share Posted September 4, 2011 Charles got it pretty close. Procedure GetObjectFromRecord; Procedure DoIt(DoItHandle :Handle); Begin Message(Date(2,2),' The Handle to the object is ',DoItHandle); SetSelect(DoItHandle); End; Begin ForEachObject(DoIt,(('MK_Format'.'MK_Text'='Circle'))); End; Run(GetObjectFromRecord); The above code will loop through each object that has the specific record value. It is up to you to make sure they are unique if you need a way to get just one. Quote Link to comment
ccroft Posted September 4, 2011 Share Posted September 4, 2011 Even better! I didn't think of doing it all with criteria. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.