AnsweredAssumed Answered

VBscript expression for creating label using collection dates

Question asked by jaysandeen on May 17, 2018
Latest reply on May 23, 2018 by kenbuja

Good day all,

 

I'm a complete novice when it comes to in depth VBscripting.  I have a layer of natural gas pipelines that I want to label with the material type, pipe diameter and an extra label that will read *OLD* for any pipes installed prior to 1982.  I've been using the following script with minimal success:

 

Function FindLabel ( [MATERIAL], [NOMINALDIAMETER], [INSTALLEDDATE]  )

if [INSTALLEDDATE] <= 01-01-1982 then
ExtralLabel = "*OLD*"
end if


  FindLabel = [MATERIAL] & " " & [NOMINALDIAMETER]  & """  " & ExtraLabel
End Function

 

I don't get any errors when I verify the script but I also don't get the extra label for *OLD*.  The pipe material and diameter labels appear just fine.  I've tried several different formats for the date (1982-01-01, 01-01-1982, #01-01-1982#, (01-01-1982) and several other permutations).  The format for the date in the attribute table is mm/dd/year.  Any advice would be appreciated.

Outcomes