James Russell Posted November 21, 2011 Share Posted November 21, 2011 Hi all, Just wondering if someone can give me a rundown on handles in relation to search criteria. At the moment I have 4 rectangles with a record called 'Dimming Info'. There are only two fields in this record thus far called 'Name' and 'Type'. At the moment the rectangles are labelled 'Dim 1', 'Dim 2', 'Dim 3' and 'Dim 4' in their name field with misc data in type. At a later stage I want to copy data from additional fields within this record using the GetRField() command. My thought process was to define a specific search criteria and then select the object: {Set Criteria where DIMLBL is user input string of name eg. Dim 1} criteria:=concat('(''Dimming Info''.''Name''='',DIMLBL,''')'); {Select said criteria} SelectObj(criteria); {Handle to dimmer as first selected object} DIMHNDL:=FSActLayer; {Take info from said handle and record into dimType (String)} dimType:=GetRField(DIMHNDL,'Dimming Info','Type'); This seems to work on some searches really well but then the next search (running the script again) seems to either save the previous values and print those or print nothing at all. I have a feeling =FSActLayer is the problem but just can't quite get there. Any help much appreciated. Cheers, James Quote Link to comment
maarten. Posted November 21, 2011 Share Posted November 21, 2011 Have a look at ForEachObject. That way you don't need to make a selection and loop trough the selected objects. Quote Link to comment
Pat Stanford Posted November 21, 2011 Share Posted November 21, 2011 I think you can fix this by adding a DSelectAll; at the beginning of the script. I have not tried your script, but it appears that the first time through it will select and object and return that object. The second time it will add a second item to the selection, but the first selected item will be the one from the first run. Let me know if you have other questions. Quote Link to comment
James Russell Posted November 21, 2011 Author Share Posted November 21, 2011 Thanks Maarten and Pat, I'll have another go tonight when I've got some spare time and see how we go. I'll let you know, J Quote Link to comment
James Russell Posted November 22, 2011 Author Share Posted November 22, 2011 All sorted and functioning correctly. Thanks guys! Cheers, J 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.