Markter Posted January 4, 2005 Report Share Posted January 4, 2005 Good Day everyone, I have a variable that is a date of birth (mm/dd/yyyy). I need to enter the month into a webpage field that is a drop down box with a list of months to pick from(JAN,FEB,...) I can easily split out the month from the variable, but I am not sure what is the easiest way to convert the "01" to "JAN", and then select "JAN" in the drop down list. Has anyone done this before? Thanks! -Mark Quote Link to comment Share on other sites More sharing options...
kevin Posted January 4, 2005 Report Share Posted January 4, 2005 Markter, You can use either the Switch/Case set of commands or the If Variable/Else set of commands. Using Switch/Case took 37 lines of macro commands (excluding comments). Using If Variable/Else took 46 lines of macro commands. These examples depend on the variable for months 1 through 9 containing a leading '0' (eg: 01 - 09). If the value does not contain a leading 0 then you will need to adjust the macro commands. The Switch/Case technique looks like this: Switch (T1) Case: 01 Variable Set String %T2% "Jan" End Case Case: 02 Variable Set String %T2% "Feb" End Case Case: 03 Variable Set String %T2% "Mar" End Case Case: 04 Variable Set String %T2% "Apr" End Case Case: 05 Variable Set String %T2% "May" End Case Case: 06 Variable Set String %T2% "Jun" End Case Case: 07 Variable Set String %T2% "Jul" End Case Case: 08 Variable Set String %T2% "Aug" End Case Case: 09 Variable Set String %T2% "Sep" End Case Case: 10 Variable Set String %T2% "Oct" End Case Case: 11 Variable Set String %T2% "Nov" End Case Case: 12 Variable Set String %T2% "Dec" End Case End Switch The If Variable/Else technique looks like this: // Same macro using If statements If Variable %T1% = "01" Variable Set String %T2% "Jan" Else If Variable %T1% = "02" Variable Set String %T2% "Feb" Else If Variable %T1% = "03" Variable Set String %T2% "Mar" Else If Variable %T1% = "04" Variable Set String %T2% "Apr" Else If Variable %T1% = "05" Variable Set String %T2% "May" Else If Variable %T1% = "06" Variable Set String %T2% "Jun" Else If Variable %T1% = "07" Variable Set String %T2% "Jul" Else If Variable %T1% = "08" Variable Set String %T2% "Aug" Else If Variable %T1% = "09" Variable Set String %T2% "Sep" Else If Variable %T1% = "10" Variable Set String %T2% "Oct" Else If Variable %T1% = "11" Variable Set String %T2% "Nov" Else If Variable %T1% = "12" Variable Set String %T2% "Dec" End If End If End If End If End If End If End If End If End If End If End If End If Quote Link to comment Share on other sites More sharing options...
Markter Posted January 4, 2005 Author Report Share Posted January 4, 2005 Thank you Kevin. I used the Switch/Case commands. Works great. I greatly appreciate you help. -Mark Quote Link to comment Share on other sites More sharing options...
Nicolas Posted January 4, 2005 Report Share Posted January 4, 2005 I need to enter the month into a webpage field that is a drop down box with a list of months to pick from(JAN,FEB,...) if this month has to be selected in a drop down box, I would rather convert this month into an integer (let's say %N1%), focus on this drop down box and do something like that : Repeat with Variable using %N1% Text Type: <ARROW DOWN> Repeat End to have the focus on your drop down box, you could click somewhere in the webpage and Text Type <TAB> Quote Link to comment Share on other sites More sharing options...
Markter Posted January 4, 2005 Author Report Share Posted January 4, 2005 Thank You Nicolas, That does simplify things for me. Quote Link to comment Share on other sites More sharing options...
randallc Posted March 19, 2005 Report Share Posted March 19, 2005 Hi I have a variable that is a date of birth (mm/dd/yyyy). I need to enter the month into a webpage field that is a drop down box with a list of months to pick from(JAN,FEB,...) I can easily split out the month from the variable, but I am not sure what is the easiest way to convert the "01" to "JAN", and then select "JAN" in the drop down list if this month has to be selected in a drop down box, I would rather convert this month into an integer (let's say %N1%),%), focus on this drop down box and do something like that : I would agree that the drop down box needs the integer, most likely, though it still may be simpler if you have the month. Here is the conversion from “04/05/67” DOB to month of year, without needing “Case” or “Switch” or “If”; Variable Set String %T95% "04/05/67"Variable Modify String: Append "\s00:00:00" to %T95% Variable Set String %T34% "<DT:MMM\sT:12:2:%T95%>" Run Macro in Variable %T34% Variable Modify String: Uppercase %T12% Text Box Display: T12 [Really only 3 lines if you already have the date in the string, and wu uppercase or display] (Returns “MAY” in Australia, but probably “APR” in USA, so watch format;) Best, Randall <TVAR2:95:01:4/5/67><TMVAR2:07:95:00:000:000:\s00:00:00><TVAR2:34:01:<DT:MMM\sT:12:2:%T95%>><RUNMACVAR:34><TMVAR2:12:12:00:000:000:><TBOX4:T:1:CenterCenter000278000200:000:T12T12=%T12%> Or set Date as you wish it in T96; Variable Set String %T95% "04/05/67"Variable Set String %T96% "dddd, MMMM dd, yyyy [c]" Variable Modify String: Append "\s00:00:00" to %T95% Variable Set String %T34% "<DT:%T96%\sT:12:2:%T95%>" Run Macro in Variable %T34% Text Box Display: T12 Produces; Australian Date Format: T12=Thursday, May 04, 1967 [4/05/1967] <TVAR2:95:01:04/05/67><TVAR2:96:01:dddd, MMMM dd, yyyy [c]><TMVAR2:07:95:00:000:000:\s00:00:00><TVAR2:34:01:<DT:%T96%\sT:12:2:%T95%>><RUNMACVAR:34><TBOX4:T:1:CenterCenter000278000200:000:T12Australian Date Format: T12=%T12%> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.