Jump to content

Vectorscript Help (SOLVED)


Recommended Posts

Hey guys,

Starting Vectorscripting and have made this so far:

Procedure Test;

VAR

WSH :Handle;

Begin

WSH:=CreateWS(Concat('Test - ',Date(2,1)),10,5);

SetWSCellFormula(WSH,1,0,1,0,'=DATABASE(R IN ('JAMES'))');

End;

Run(Test);

All going well I'm aiming to make this script make a worksheet, date it, and then change row 1 to a database lookup searching for objects with the record James.

Error messages:

Line #9: SetWSCellFormula(WSH,1,0,1,0,'=DATABASE(R IN ('JAMES'))');

|

{ Error: Identifier not declared. }

|

{ Error: Expected ) }

|

{ Error: Did not expect this after end of statement - missing ;? }

Help please? Pretty sure it'd be simple but just not quite there!

Cheers,

James

Edited by James Russell
Link to comment

Strings are delimeted by single quotes. In your formula

'=DATABASE(R IN ('JAMES'))'

the compiler reads it as

'=DATABASE(R IN ('

then JAMES which interprets as a variable

and then '))'

the formula should be written as

'=DATABASE(R IN (''JAMES''))'

where the double single quotes denotes a single quote character.

Link to comment

Or my favorite way of doing this:

DBCrit := Concat('=Database(((L= ', chr(39), Lname ,chr(39), ' )&

(T=Symbol) ))');

The chr(39) converts to an actual in line quote mark before and after

the Lname.

The original code worked fine on layers without spaces in the layer

name, but failed if there were spaces.

using multiple quotes is correct and certainly works, but my eyes cross on

trying to tell the difference between double and triple quotes. It is

hard to miss the chr() in the middle of the concat.

Link to comment

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.

×
×
  • Create New...