justin1974 Posted February 23, 2003 Share Posted February 23, 2003 Can someone show me an example script of how to get information from a PIO to record fields. example: PIO draws a rectangle. Creates a record "rectangle" with fields 'width' & 'depth' feild info is linked to rectangle so when size of rectagle is chagned feilds update. Thanks Quote Link to comment
Alexandre Villares Posted February 24, 2003 Share Posted February 24, 2003 Justin, Each parameter on a PIO is already automatically stored as a field at a record attached to each instance of the PIO, you can find this record using: GotPIO := GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand); {GotPIO is a boolean (true/false) variable I invented just to allow me to use the GetCustomObject function, it stores 'true' if it suceeds.} You can see those records when you perform a Custom Selection looking for a Record/Field value, or when you create a Report. Create your rectangle PIO or insert some NNA PIOs and have a look at the Custom Selection and Create Report commands at the Organise menu. [ 02-23-2003, 07:32 PM: Message edited by: Alexandre B A Villares ] Quote Link to comment
Alexandre Villares Posted February 24, 2003 Share Posted February 24, 2003 Once you've got a PIO's record you can even set one of it's parameters value from inside it: IF GotPIO THEN SetRField(objectHand, Getname(recordHand), ParameterName, Num2StrF(ParameterNewValue)); For example, if a boolean parameter PSquare is true, make it set pH to pW... Please note that when you set a parameter from inside the PIO it's new value is only noticed at the next redraw, so I would recommend setting a second pair of intermediate variables to do the drawing. [...] W:=pW; H:=pH; IF pSquare & GotPIO THEN BEGIN SetRField(objectHand, Getname(recordHand), 'H' , Num2StrF(W)); H:=W; END; Rect (0,0,W,H); {not Rect(0,0,pW,pH)} HTH, Alexandre Quote Link to comment
justin1974 Posted February 24, 2003 Author Share Posted February 24, 2003 Okay When using the REPORT function my PIO records are there, but the Resourses folder of the document, nor the Data Tab (on Object Info) show this record format.... Why?. When I use a VW PIO the Data Tab and Resourse Folder show the record format. I can do what I need from the report functions, but as matter of interest how do I make the record formats show in the Data tab and see record in resources?. Quote Link to comment
Alexandre Villares Posted February 24, 2003 Share Posted February 24, 2003 I think it is by design that those records are hidden from the normal interface, note that they 'are' the PIOs parameters and should not be changed carelessly... [ 02-25-2003, 06:53 PM: Message edited by: Alexandre B A Villares ] Quote Link to comment
Jason33 Posted February 26, 2003 Share Posted February 26, 2003 hello justin, something i've done in the past is to set an external record to the object from within the pio script. you should run a GetCustomObjectInfo at the start of your pio script: result:=GetCustomObjectInfo(name,oh,rh,wh); NewField('Plug In Record','Plug In Field','Value',4,0); SetRecord(oh,'Plug In Record'); SetRField(oh,'Plug In Record','Plug In Field',Paramater Value); just remember that you need to convert the paramater value to a string before you assign the field to the object. hope this helps, -jason 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.