October 21, 200421 yr I have the following scrip that does not work... Set Field [Job System::gdate; Middle (Job System::date ; 4; 2)] If [Left (Job System::gdate; 2) = "1/" or "2/" or "3/" or "4/" or "5/" or "6/" or "7/" or "8/" or "9/"] Set Field [Job System::gdate; Middle (Job System::date ; 3; 2)] Else Exit Script End If I think there is something wrong with the If statement, because it performs: Set Field [Job System::gdate; Middle (Job System::date ; 3; 2)] no matter what it finds. Can anyone point out where I am going wrong?
October 21, 200421 yr Author I tried simplifying the scrip to... Set Field [Job System::gdate; Middle (Job System::date ; 4; 2)] If [Job System::gdate = "1/" or "2/" or "3/" or "4/" or "5/" or "6/" or "7/" or "8/" or "9/"] Set Field [Job System::gdate; Middle (Job System::date ; 3; 2)] End If But it still doesn't work, its like its just ignoring the If statement and resetting the field no matter what!
October 21, 200421 yr Why not use Set Field [Job System::gdate; Day(Job System::date)]? You'll get the same result in one step.
October 21, 200421 yr Author Because I want the month not the day. I'm from New Zealand where the date is formatted dd/mm/yy.
October 21, 200421 yr Then use Month(Job System::date). Date functions don't care about your system settings. They'll still return the right result.
October 21, 200421 yr Author No wait, I figured it out... the date fields are formatted mm/dd/yy. Once I changed them to our format, it worked! Thanks
October 21, 200421 yr The format shouldn't matter, because dates are internally stored as numbers. So Month(datefield) will work for any legal format or system setting since it doesn't pay attention to them.
October 21, 200421 yr But Cat8 is using string manipulation commands, like Left and Middle, and so I think it would matter. That's why I asked for the format of date and gdate.
October 22, 200421 yr I was referring to format, not field type. And yes, Cat was using string commands that aren't necessary when a simple Month( ) function will suffice.
October 23, 200421 yr Right. Why use string manipulation when the month function will work regardless of field format!
Create an account or sign in to comment