VBScript Code Development - Build Array variable from db values
Budget: $10 – $30 USD
Generate VBScript code to create an array of values based on "boolean" flags stored in 6 columns in a database. "Boolean" flags will be 0 (NO) or 1 (YES). If one of the column values is "1", it's corresponding name will be added to the array. If the value of the column is "0" (zero) the value will not be added to the array. The array should be semicolon (;) delimited. We only need the code built so we can insert it into our program.
Here are the 6 columns that should be checked:
"GHS Skull & Crossbones"
"GHS Dead Tree & Fish"
"GHS Health Hazard"
"GHS Oxidizers"
"GHS Exclamation"
"GHS Explosion"
The values that should be written to the array for each column (if the value is "1") are:
GHS_SC.png ("GHS Skull & Crossbones")
GHS_DTF.png ("GHS Dead Tree & Fish")
GHS_HH.png ("GHS Health Hazard")
GHS_OX.png ("GHS Oxidizers")
GHS_EXC.png ("GHS Exclamation")
GHS_EXP.png ("GHS Explosion")
Example 1:
"GHS Skull & Crossbones" = 1
"GHS Dead Tree & Fish" = 0
"GHS Health Hazard" = 0
"GHS Oxidizers" = 1
"GHS Exclamation" = 1
"GHS Explosion" = 0
RESULTING ARRAY FOR EXAMPLE 1: GHS_SC.png;GHS_OX.png;GHS_EXC.png
Example 2:
"GHS Skull & Crossbones" = 0
"GHS Dead Tree & Fish" = 0
"GHS Health Hazard" = 1
"GHS Oxidizers" = 1
"GHS Exclamation" = 0
"GHS Explosion" = 0
RESULTING ARRAY FOR EXAMPLE 1: GHS_HH.png;GHS_OX.png
Psuedo code example:
if Format.NamedSubStrings("GHS Health Hazard").Value = 1 THEN
Add GHS_HH.png to Array
End If
if Format.NamedSubStrings("GHS Oxidizers").Value = 1 THEN
Add GHS_OX.png to Array
End If
Here are the 6 columns that should be checked:
"GHS Skull & Crossbones"
"GHS Dead Tree & Fish"
"GHS Health Hazard"
"GHS Oxidizers"
"GHS Exclamation"
"GHS Explosion"
The values that should be written to the array for each column (if the value is "1") are:
GHS_SC.png ("GHS Skull & Crossbones")
GHS_DTF.png ("GHS Dead Tree & Fish")
GHS_HH.png ("GHS Health Hazard")
GHS_OX.png ("GHS Oxidizers")
GHS_EXC.png ("GHS Exclamation")
GHS_EXP.png ("GHS Explosion")
Example 1:
"GHS Skull & Crossbones" = 1
"GHS Dead Tree & Fish" = 0
"GHS Health Hazard" = 0
"GHS Oxidizers" = 1
"GHS Exclamation" = 1
"GHS Explosion" = 0
RESULTING ARRAY FOR EXAMPLE 1: GHS_SC.png;GHS_OX.png;GHS_EXC.png
Example 2:
"GHS Skull & Crossbones" = 0
"GHS Dead Tree & Fish" = 0
"GHS Health Hazard" = 1
"GHS Oxidizers" = 1
"GHS Exclamation" = 0
"GHS Explosion" = 0
RESULTING ARRAY FOR EXAMPLE 1: GHS_HH.png;GHS_OX.png
Psuedo code example:
if Format.NamedSubStrings("GHS Health Hazard").Value = 1 THEN
Add GHS_HH.png to Array
End If
if Format.NamedSubStrings("GHS Oxidizers").Value = 1 THEN
Add GHS_OX.png to Array
End If