Jump to content
tbexon

Creating Worksheet Database Rows

Recommended Posts

Hello

 

I'm trying to create a worksheet with a database row that looks for a certain record and then displays each field in it's own column. 

 

The issue i'm running into is actually making the row into a database row. Below is the code I am using at the moment. My understanding (which I suspect is wrong) is that I need to set the a formula for row 2 column 0.

dynCharArray = '=DATABASE(INVIEWPORT & INSYMBOL & (R IN [Loom Note]))'
vs.SetWSCellFormulaN(tempHandle,2,0,2,0,dynCharArray);

When I run the code I get a popup box saying "Right Bracket Expected", no error messages from the script, just that popup box, and the script will have failed to turn the row into a database row. 

 

From my googling I'm struggling to find much documentation for building worksheets with Python Script/ Worksheet Formulas. (I'm sure it's out there I'm probably just not looking in the right places.)

 

Would anyone be able to point me in the direction of some handy info on worksheet formulas, or give me a hint as to what i'm doing wrong here?

 

Running VW 2020 Sp3.1 

Share this post


Link to post

I think Loom Note (the record name) needs to be a string and have quotes around it.

 

You are supposed to be able to use double single quotes to "escape" a single quote you need inside a string. So something like:

 

dynCharArray = '=DATABASE(INVIEWPORT & INSYMBOL & (R IN [''Loom Note'']))'

 

But I can never tell if that is a two single quotes or a single double quote. For future readability I would use something like:

 

dynCharArray = Concat('=DATABASE(INVIEWPORT & INSYMBOL & (R IN [', CHR(39), 'Loom Note', CHR(39),']))'

 

Where the CHR(39) will generate the single quote marks you need.  

 

Harder to write but much easier to see exactly what you have.

 

 

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...