Vb Script For Conditional Expression Follow

0
Avatar
Legacy Poster

Hi,

 

I'm migrating from LabelView 8 to Bartender 2016 R2 and I'm requiring assistance with creating a VB Script, I think, to replace the below expression that is currently being used in LabelView:

 

if(weightPerRecipeUnit >= 1000,  div(weightPerRecipeUnit, 1000) + "Kg", Round(weightPerRecipeUnit,0) + "g")

 

I can configure the condition, using the "When to Print" function, but I can't insert the algebraic expressions in this function; I presume this needs to occur via a VB script?

 

I'm not familiar with VB so any assistance is very much appreciated.

 

Thanks,

 

Andrew

3 comments

0
Avatar
Legacy Poster
Comment actions Permalink

Update

 

The below seem to work but how do I append a string ('g' or 'kg') to the end of the values?

 

If Field("weightPerRecipeUnit")>= 1000 Then

value = Field("weightPerRecipeUnit")/1000

Else

value = Round(Field("weightPerRecipeUnit"))

End If

 

Thanks,

 

Andrew

 

0
Avatar
Legacy Poster
Comment actions Permalink

Try:

 

Value = (Field"weightPerRecipeUnit")/1000) & "Kg"

 

And:

 

Value = Round(Field("weightPerRecipeUnit")) & "g"

0
Avatar
Legacy Poster
Comment actions Permalink

Many thanks KM. Works as required.

Please sign in to leave a comment.