Get metadata with VBScript

Hi,

Can you please translate the following line into VBScript?

var contentsetId = exp(‘GetMeta(_vger_Customer_Number[0], 10, Job.Group[0])’); (Jason code)

I just want to get the value of a metadata filed (Customer_Number) with VBScript.

Thanks a lot.

John

contentsetId= Watch.ExpandString( “GetMeta(_vger_Customer_Number[0], 10, Job.Group[0])” )

Thanks Phil.

But I can’t get any value with this piece of code with a Run Script task in workflow:

Dim myVar = Watch.ExpandString( “GetMeta(_vger_fld_CustomerNumber[0], 10, Job.Group[0])” )
Watch.Log "Test Customer Number is: " + CStr(myVar), 2

Any idea?

John

Hi John,

maybe it’s only your Dim. In VBScript you can’t define a variable and immediately assign a value to it. Please try to split into two lines:

Dim myVar

myVar = …

Thanks RenteIL for your reminder. I did have tried that way, but still not working. I am not sure why the first index is 0, and then with a constant 10, and last with another index 0. Really confused with the syntax.

John

Hi John,

As RentelL mentioned, remove the Dim in front of your variable name.

Then take a look at this section in the online help: http://help.objectiflune.com/en/pres-workflow-user-guide/8.6/Default.html#Workflow/Data/Data_Selections.html#toc-6. It explains the syntax and the index values.

Thanks Phil. I just read the online doc and understood the syntax now. I wish there were some sample code in the online doc. I have tried several times last year and this year to search a syntax or some solutions from online documents (including workflow guide, manual etc.) whenever I run into problems, but was disappointed as I couldn’t find any sample code to follow.

John