Markus Barrera-Kolb Posted August 20, 2012 Share Posted August 20, 2012 Hello, does anyone know if there's a way to feed a calculated value into a Record Field within a Record Format from a value calculated in a worksheet? I've come across the SetRField function, but don't know whether it'll do this nor what the appropriate syntax would be. Thanks! Cheers, Markus Quote Link to comment
JBenghiat Posted August 21, 2012 Share Posted August 21, 2012 Hi Markus, If I understand you correctly, you are using a worksheet to do some calculations, and you want a way to easily get the result into a record field. One way to do this is to have the worksheet display the records as a database. Perhaps the easiest way to do this is with the Create Report menu command, at least to see what a database looks like. You can simply paste your result there. If you do need a more automated solution, SetRField is part of the answer, though the most complicated part is getting a handle to the object whose record you want to affect. I think we can better help you if we know to what your record is attached. For syntax, look at developer.vectorworks.net. Also have a look at the VS Language Guide, accessible in the help app. That may give you a start in the right direction. HTH, Josh Quote Link to comment
Markus Barrera-Kolb Posted August 22, 2012 Author Share Posted August 22, 2012 Thanks Josh, I am indeed displaying the records as a database within the worksheet. What I've done is to create a symbol with text that is linked to the Fields within the Record Format. The idea is that I can enter values for some of the fields within the worksheet and then have VW calculate a value from these that will get plugged into another field in the Record Format. For instance: Record Format: "Format 1" Fields: "Field 1", "Field 2", & "Field 3" The database criteria are set to display all of the objects with the "Format 1" record attached, and I'd like to be able to manually enter "Field 1" and "Field 2", and then, for the sake of argument, have VW set the value of "Field 3" to Field 1 + Field 2. I'm not even sure if this is something that I can do within the worksheet. For that matter, I imagine that even if I can accomplish this in the the worksheet, when someone enters new values for "Field 1" or "Field 2" through the Data tab of the OIP for one of the symbols, "Field 3" wouldn't get updated until the worksheet is recalculated. However, this would be acceptable... I still haven't been able to figure out how to get SetRField to work for this ? is there a way to do it? Thanks again, Markus Quote Link to comment
JBenghiat Posted August 31, 2012 Share Posted August 31, 2012 Markus, Are you asking about using SetRField directly in the worksheet? If so, you cannot do that -- you can't automatically set values using the worksheet alone. You can, however, include a calculation in a database row. So if in your example, your database is in row 2, cell D2 could be =A2+B2. If you want that total to go back into your database, you could select the D2.n cells, copy, and paste into C2.n. Not automatic, but easy and well within your grasp, and no scripting involved. If you want Field 2 to automatically calculate, you could build a Plug-in object that handles your database as object info parameters instead of ordinary record formats. If you are attaching your record to something constant, like a symbol or a locus, this can be fairly easy. You can access PIO parameter data in a worksheet just like ordinary record data. This would require you to delve into some VectorScripting. -Josh Quote Link to comment
Markus Barrera-Kolb Posted August 31, 2012 Author Share Posted August 31, 2012 I think this is what I more or less suspected. If I understand correctly, I could potentially use Vectorscript to have the one PIO parameter value automatically calculated from the other two, and then this of course could be displayed in a database row in a worksheet. Sounds like I'll have more homework to do if I want to implement it... Thanks again! Cheers, Markus Quote Link to comment
JBenghiat Posted September 3, 2012 Share Posted September 3, 2012 Yes, that is correct. As PIO's go, what you describe would be relatively simple and not a bad starter project. -Josh 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.