Re: Month as Integer
Re: Month as Integer
- Subject: Re: Month as Integer
- From: Richard 23 <email@hidden>
- Date: Thu, 30 Nov 2000 12:38:27 -0800
>
I know it doesn't work as it stands but maybe it's just a matter of
>
coding it right.
>
'return November of themonthlist' works fine, so the question really
>
is how you specify a named record by a variable? (wasn't this
>
discussed recently? I think it was about using variable variable
>
names but that should be related)
I really don't think so. I've tried this sort of thing before and
it always resolves to a similar checkmate.
You can redefine the constants no problem:
I do the same sort of thing to provide my scripts with name and
version properties which can be useful when the script has been
brought into another script with "load script". It makes its
easy to uniquely identify what would otherwise be anonymous.
Back to the month problem:
property March: 3
to get the value rather than the constant you use my:
return {March, my March}
--> {March, 3}
by this time you think you're almost there but then it hits you.
How can you get the constant value "March" being held in a variable
to reference the script's (or current application's) March property?
Well, you don't. Your variable would be be holding a value of type
"class", while your script contains a user defined property holding
a value of the integer class. The two values cannot exist in the same
container at the same time therefore they are entirely different items.
The fact that they share the same label makes no difference. They may
as well be in different scripts because you'll never get them to mesh.
If someone can prove me wrong I'd appreciate it.
Good idea, but no cigar.
Here's one of the methods I've used but it's still a bit wordy:
property Month_String : "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
count words of (text 1 thru (offset of (text 1 thru 3 of ==>
(theDate's month as string)) in Month_String) of Month_String)
I'd like this numerical coercion and a boolean to integer coercion.
A lot of times getting false as 0 or true as 1 would be convenient but
is currently not possible without and if-then-else construct.
R23