Jump to content
Developer Wiki and Function Reference Links ×

Vectorscript to Increment record data


Recommended Posts

I'm trying to write a script that will update the P_Revision Number field on my custom title block + 1 of the current value.   I have the below,  but everytime I try to read the record it only returns 0.   The default value of the revision field is 1.

Procedure Update_Rev;

VAR
	current_rev :INTEGER;
	new_rev :INTEGER;
	hd: HANDLE;

Begin
	current_rev:=Str2Num(GetRField(hd,'Vista Title Block','P_Revision Number'));
	new_rev:=current_rev + 1;
	SetRField(FSActLayer,'Vista Title Block','P_Revision Number',Num2Str(0,new_rev));
End;

{---------------------------------------------------------------------------------------}

Run(Update_Rev);

What am I missing?

 

Record format for Title Block attached.

 

 

Screen Shot 2017-08-21 at 10.07.14 AM.png

Edited by Wes Burrows
spelling and clarification.
Link to comment

Ok, well i fixed it by changing the GetRField Handle to FsActLayer.     Now I just need to figure out how to get the script to select anything with the title block  "Vista Title Block" record.  So I don't have to select the sheet border or anything for it to work.   I also want to get it to update it across all sheets.   Even though I'm updating "P_Revision Number"  It only updates on the currently selected sheet.  Thoughts?

 

Procedure Update_Rev;

VAR
	current_rev :INTEGER;
	new_rev :INTEGER;
	hd: HANDLE;

Begin
	current_rev:=Str2Num(GetRField(FSActLayer,'Vista Title Block','P_Revision Number'));
	new_rev:=current_rev + 1;
	SetRField(FSActLayer,'Vista Title Block','P_Revision Number',Num2Str(0,new_rev));
End;

{---------------------------------------------------------------------------------------}

Run(Update_Rev);

 

Edited by Wes Burrows
spelling
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...