Skip to main content

Search

Search

How to return a blank value when another value is not returned

Comments

5 comments

  • Avatar
    Peter Thane

    You could add an extra If statement and variable so that if the CS is blank then it uses the new variable that has a value of 1 otherwise it uses the CS value.

    Something like 

    Value2 = 1

    If Value1= 0 then

    Value2 = Value2 else

    Value2 = Value1

    endif

     

    and then you final command would instead end Value/Value2

    0
  • Avatar
    Greg Zavela

    Thank you for the suggestion Peter.  However, the issue is if there is no value of CS, then I need the label to not print a value (i.e. leave the value as blank).

    0
  • Avatar
    Peter Thane

    Change it to this and hopefully that should work for a blank or a value now for CS

    Value2 = 1

    If Value1= "" then

    Value2 = Value2 

    else Value2 = Value1

    end if

    0
  • Avatar
    Greg Zavela

    Hi Peter,

    Thank you for the suggestions!  I found the search and replace function under the transforms tab of my named data source.  I was able to set Value1 equal to a dummy value that would never be returned if the CS unit of measure does not exist, then I did a search and replace to replace said value with one space which essentially makes the value become blank.  One thing I think I have discovered is it appears that the VBScript does not work like Excel where in a nested IF statement once the condition(s) has been met the nested IF statement stops there and returns the values from the true part of the statement.

    0
  • Avatar
    Peter Thane

    No worries. BarTender doesn't use the full VB but VB Script and so somethings are handled slightly differently

    0

Please sign in to leave a comment.