Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-15-2014, 02:36 PM
Tony2 Tony2 is online now
Registered User
 
Join Date: 03-22-2011
Posts: 3
Question Accessing macro array elements

Hi all

So I have a step which reads a file using a regex and matches 4 groups.
I have the option "Store matching groups in array"
And the macro it is going in is named DATABASE

If I log %DATABASE% to the output then I get 4 lines containing the information.
I need to be able to access each element individually so that I can run a command line putting the right elements in the right places....

How do I do this, I can't find anything on accessing a macro array in the help....

Thanks
Reply With Quote
  #2  
Old 01-15-2014, 02:52 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
See the attached sample for how to access via a Loop action or Run Script action.
Attached Files
File Type: bld array.bld (1.4 KB, 2017 views)
Reply With Quote
  #3  
Old 01-15-2014, 03:10 PM
Tony2 Tony2 is online now
Registered User
 
Join Date: 03-22-2011
Posts: 3
Thanks..

So no way to do %macro[1]% or something? I'm already in a loop so would now have nested loop and another 4 macros....

I'm almost thinking of having 4 different steps each matching one of the four groups I currently have. Would look less messy.
Reply With Quote
  #4  
Old 01-15-2014, 03:20 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Define a project or global script function like so:

Code:
Function ArrayElem(name, index)	
	a = vbld_TempMacro(name)
	ArrayElem = a(index)
End Function
and call like this in a Run Script step:

Builder.LogMessage ArrayElem("DATABASE", 0)

or like this in a field:

[ArrayElem("DATABASE", 0)]

http://www.kinook.com/VisBuildPro/Ma...ripteditor.htm
http://www.kinook.com/VisBuildPro/Ma...xpressions.htm
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 03:27 AM.


Copyright © 1999-2023 Kinook Software, Inc.