matteoluigi Posted October 1, 2020 Share Posted October 1, 2020 Hi, does there exist any possibility to write data from a Vectorscript-Script directly into an existing Vectorworks-worksheet? I didn't find a corresponding command. (maybe because the command doesn't exist) Alternative would be using "runscript" directly from the worksheet. Therefor I need to read out column A and insert it as variable in the script. (For example - A1: 1 -> "there are x 1-room-apartments") Quote Link to comment
Peter Vandewalle Posted October 1, 2020 Share Posted October 1, 2020 You can use the SetWSCellFormulaN command to fill text or formulas into a worksheet cell. That won't be a cell in a database row however. These rows are calculated and can only show object data. That object data may be seen very large, certainly with the RunScript possibilities. https://developer.vectorworks.net/index.php/VS:SetWSCellFormulaN Quote Link to comment
Pat Stanford Posted October 1, 2020 Share Posted October 1, 2020 This thread has a script that collects the field types of a PIO and creates a worksheet of that data. It might help you to see the syntax you need. Quote Link to comment
matteoluigi Posted October 1, 2020 Author Share Posted October 1, 2020 2 minutes ago, Pat Stanford said: This thread has a script that collects the field types of a PIO and creates a worksheet of that data. It might help you to see the syntax you need. wow, thanks! sounds great! Quote Link to comment
matteoluigi Posted October 2, 2020 Author Share Posted October 2, 2020 works nearly fine, however SetWSCellFormulaN only works with Strings or Char - Variables. I'd like to insert an Integer-Value. How could I do that? Is there any possibility to transform an Integer-Value into a String? Or feed a String-Variable with Integer-content? EINZW: INTEGER; inString := EINZW; SetWSCellFormulaN(worksheet, zeile, 2, zeile, 2, inString); Quote Link to comment
matteoluigi Posted October 2, 2020 Author Share Posted October 2, 2020 Num2Str should do it with EINZW as REAL Number... 1 Quote Link to comment
matteoluigi Posted October 2, 2020 Author Share Posted October 2, 2020 works fine ✔️ Quote Link to comment
matteoluigi Posted October 3, 2020 Author Share Posted October 3, 2020 And Num2Str also does work with Integer instead of Real variables. Quote Link to comment
Pat Stanford Posted October 3, 2020 Share Posted October 3, 2020 In Vectorscript (and probably all of VW), Integers (and LongInts) are a subset of Reals. That means that anywhere a real is specified you can also use an Int or LongInt. If a LongInt is required you can use either an Integer or a LongInt. If an Integer is required, you can only use an Integer (unless someone else wants to do the multiple paragraph explanation of how a Boolean is really an subset of integer and can be used....). ;-) Quote Link to comment
Pat Stanford Posted December 22, 2020 Share Posted December 22, 2020 Actually, what I said above about Reals/Integers/LongInts is a little misleading. Any Vectorscript function that takes a Real as a non-changeable INPUT can use an Int or LongInt instead of the specified Real value. Anything that OUTPUTS a Real (or uses a Real that is changeable [using a VAR in the function/procedure declaration]) will require an variable declared as Real. So an Integer can substitute for a Real as an input, but if you want an Integer from a Real output you will have to use a Trunc or Round function. 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.