Turning Multi "else if" Statements Into a "repeat with x in some_list"

Hi everyone,
I'm trying to make this into a more efficient/compact handler:
repeat with SomeString in WkList
--some code here
if CurMonthYearResults contains "Sept" then
set label index of result to 4
else if CurMonthYearResults contains "Jan" then
set label index of result to 4
else if CurMonthYearResults contains "Feb" then
set label index of result to 5
else if CurMonthYearResults contains "March" then
set label index of result to 6
else if CurMonthYearResults contains "April" then
set label index of result to 7
else if CurMonthYearResults contains "May" then
set label index of result to 1
else if CurMonthYearResults contains "June" then
set label index of result to 2
else if CurMonthYearResults contains "July" then
set label index of result to 3
else if CurMonthYearResults contains "Aug" then
set label index of result to 4
else if CurMonthYearResults contains "Oct" then
set label index of result to 5
else if CurMonthYearResults contains "Nov" then
set label index of result to 6
else if CurMonthYearResults contains "Dec" then
set label index of result to 7
else
set label index of result to 2
end if
end repeat
Preferably one which is the most compact (a "repeat with x in some_list" ?). Would anyone be able to assist me in this. TIA
Regards,
ByTheLight...

Hello Hiroto,
Many Thanks for your assistance. I'm not sure that I can figure out how to apply your code to my script, so I'm posting the full code now to make things clearer. Here's the code:
set CurDate to (current date)
tell CurDate to get its month & year as string
set CurMonthYearResults to result
tell application "Finder"
set WkList to {"FirstWeek-", "SecondWeek-", "ThirdWeek-", "4thWeek-", "5thWeek-"}
repeat with SomeString in WkList
make new folder at alias "pathto_defaultfolder" with properties {name:SomeString & CurMonthYearResults}
if CurMonthYearResults contains "Sept" then
set label index of result to 4
else if CurMonthYearResults contains "Jan" then
set label index of result to 4
else if CurMonthYearResults contains "Feb" then
set label index of result to 5
else if CurMonthYearResults contains "March" then
set label index of result to 6
else if CurMonthYearResults contains "April" then
set label index of result to 7
else if CurMonthYearResults contains "May" then
set label index of result to 1
else if CurMonthYearResults contains "June" then
set label index of result to 2
else if CurMonthYearResults contains "July" then
set label index of result to 3
else if CurMonthYearResults contains "Aug" then
set label index of result to 4
else if CurMonthYearResults contains "Oct" then
set label index of result to 5
else if CurMonthYearResults contains "Nov" then
set label index of result to 6
else if CurMonthYearResults contains "Dec" then
set label index of result to 7
else
set label index of result to 2
end if
end repeat
end tell
TIA
Regards,
ByTheLight...

Similar Messages

  • How to convert switch statement into iif than else statement in SSRS

    Hi All;
    How do i convert switch statement into iif statement in ssrs
    =
    Switch(
    Fields!createdonValue.Value = Now(), "Today",
    Fields!createdonValue.Value = DateAdd("d",-1,Today()),"Yesterday",
    Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -6,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
    Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Week",
    Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -13,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
    Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Fortnight",
    Fields!createdonValue.Value >= DateValue(DateAdd("M",-1,DateAdd("D",-(Day(Now)-1),Now))) and
    Fields!createdonValue.Value <= DateValue(DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now))),"Last Month",
    Fields!createdonValue.Value >= DateSerial(Year(Now()), 1, 1) and
    Fields!createdonValue.Value <= DateSerial(Year(Now()), 12, 31),"Year to Date"
    Any help much appreciated
    Thanks
    Pradnya07

    Not sure why you want to se IIF as Switch is more compact
    Anyways it will look like this
    =IIf(
    Fields!createdonValue.Value = Now(), "Today",IIf(
    Fields!createdonValue.Value = DateAdd("d",-1,Today()),"Yesterday",Iif(
    Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -6,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
    Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Week",IIf(
    Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -13,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
    Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Fortnight",IIf(
    Fields!createdonValue.Value >= DateValue(DateAdd("M",-1,DateAdd("D",-(Day(Now)-1),Now))) and
    Fields!createdonValue.Value <= DateValue(DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now))),"Last Month",IIf(
    Fields!createdonValue.Value >= DateSerial(Year(Now()), 1, 1) and
    Fields!createdonValue.Value <= DateSerial(Year(Now()), 12, 31),"Year to Date")))))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Turn multi-button mouse into single button mouse

    I thought I would never want to go back to the single button mouse that Apple preferred until recently.
    But now my 3 year old son is learning to use the computer and has a lot of problems with contextual menus popping up all over the screen. Is there any way to turn the right mouse button into a second left mouse button?
    Mac Mini, Powerbook G4, B&W G3   Mac OS X (10.3.9)  

    Hi, Wim T. If your son has his own user account on the Mac, you may be able to use the mouse's configuration software to set both buttons to do the same thing — in his account only. That would leave your own mouse-configuration preferences undisturbed. And I second Kappy's recommendation of USB Overdrive as excellent mouse-configuration software.
    Message was edited by: eww

  • VLD-1119: Unable to generate Multi-table Insert statement for some or all t

    Hi All -
    I have a map in OWB 10.2.0.4 which is ending with following error: -
    VLD-1119: Unable to generate Multi-table Insert statement for some or all targets.*
    Multi-table insert statement cannot be generated for some or all of the targets due to upstream graphs of those targets are not identical on "active operators" such as "join".*
    The map is created with following logic in mind. Let me know if you need more info. Any directions are highly appreciated and many thanks for your inputs in advance: -
    I have two source tables say T1 and T2. There are full outer joined in a joiner and output of this joined is passed to an expression to evaluate values of columns based on
    business logic i.e. If T1 is available than take T1.C1 else take T2.C1 so on.
    A flag is also evaluated in the expression because these intermediate results needs to be joined to third source table say T3 with different condition.
    Based on value taken a flag is being set in the expression which is used in a splitter to get results in three intermediate tables based on flag value evaluated earlier.
    These three intermediate tables are all truncate insert and these are unioned to fill a final target table.
    Visually it is something like this: -
    T1 -- T3 -- JOINER1
    | -->Join1 (FULL OUTER) --> Expression -->SPLITTER -- JOINER2 UNION --> Target Table
    | JOINER3
    T2 --
    Please suggest.

    I verified that their is a limitation with the splitter operator which will not let you generate a multi split having more than 999 columns in all.
    I had to use two separate splitters to achieve what I was trying to do.
    So the situation is now: -
    Siource -> Split -> Split 1 -> Insert into table -> Union1---------Final tableA
    Siource -> Split -> Split 2 -> Insert into table -> Union1

  • My iphone 5 won't turn on but when plugged into power source it keeps showing apple logo?

    My iPhone 5 won't turn on at all and then when I plug it into a power source either into a plug socket or into my laptop with the USB cable it keeps showing start up screen with apple logo over and over again on a loop.
    I have tried holding the top and front button together, this didn't work. I have also tried connecting to my laptop and following the reboot steps that I found on another discussion forum. Neither worked for me. The phone just won't reboot and it keeps continuing to loop the apple logo screen over and over without me touching anything.
    The iPhone won't even connect to itunes and so itunes seems to not recognise my phone because its not even turning on (just continually apple logo screen appears for 5 seconds, goes to black screen and then repeats).
    I don't know what is happening to it! Can anyone help? Is it a fault with the hardware or have I dont something to it? The next appointment at the genius bar for me is monday so I'm going to keep looking for any more recent ones until then but I really need to get it sorted before then so if anyone can help that would be great!
    Thanks

    Try a reset when your iPhone is plugged into the charger as you say it does not respond when not plugged in...
    Press and hold the Home and On/Off buttons simultaneously until you see the Apple logo, then release.  This may take up to 10 seconds.  This is the equivalent of a re-boot and you will not lose any data.
    See if it will charge after this.

  • Can I put more than one statement into a Condition in TestStand

    I'm trying to learn to use the Conditional statement in more than it's simplest form and I have 2 questions:
    Question 1:
    For instance simple statement is:
    Locals.nValue=(Locals.Compare>5) ? 1 : 2
    However, I want to do 2 things in the Condition
    Locals.nValue=(Locals.Compare>5) ? 1,Locals.sString = "Yes" : 2, Locals.sString = "No"
    But, this doesn't work (using the comma separator). Is there a way to put 2 statements into the conditional case?
    Question 2:
    For a series:
    Locals.nValue=(Locals.Compare>5) ? 1 : Locals.nValue
    Locals.nValue=(Locals.Compare<=5)? 2 : Locals.nValue
    Also, is there a way to do NOTHING in the Else? (The folowing was suggested in the TestStand class that I took but
    it doesn't work:
    Locals.nValue=(Locals.Compare>5 ? 1 : NOTHING
    This makes "Locals.nValue" = Nothing and I find that I can't leave the "False" condition blank.
    Mike

    Mike -
    1) You wanted to do something like this:
    Locals.nValue=(Locals.Compare>5) ? 1,Locals.sString = "Yes" : 2, Locals.sString = "No"
    You can do this like this:
    Locals.nValue=(Locals.Compare>5) ? (Locals.sString = "Yes", 1) : (Locals.sString = "No", 2)
    By using the parethesis, the parser assumes that last element in the list is the final value to be "returned".
    2) There is no way to do nothing in a conditional assignment. You wanted to do this:
    Locals.nValue=(Locals.Compare>5 ? 1 : NOTHING
    You have to assign the orginal value back to the target, like this:
    Locals.nValue=(Locals.Compare>5) ? 1 : Locals.nValue
    Scott Richardson (NI)
    Scott Richardson
    National Instruments

  • How to convert update,delete statement into select stmt

    Hi all,
         I have a field called dml_stmt, i am getting the dml statement has input from the user.
         My requirement is, if user is giving "update set col_name = 'xyz' from table_name where codition = 'aa'", before updating the table, i need to get old values from the table and put it in the audit table
         For that,i need to convert those update statement into select stmt and need to execute the query to get the data and then i will put it in the audit table..
         can anyone guide how to convert the update or delete stmt into select(need to write in pl/sql)
    Please do needfull things ......
    Regards,
    Jame

    Maybe I'm missing something, but why would auditing help here? It sounds like the user wants to know the prior values of the data, not the SQL UPDATE statement that was issued. Auditing would tell you that a table was updated, fine-grained auditing would tell you what the UPDATE statement was, but you'd need something else to capture the state of the data prior to the update.
    Depending on why putting triggers on every table was discounted, you may also want to take a look at using Workspace Manager or Total Recall (in 11g) to track a history of data changes. But triggers would be the common solution to this sort of problem.
    Justin

  • PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list

    Hi,
    I have a requirement to send a table data through mail,
    so am using execute statement after opening the connection and am using the following PLSQL code, which am failing to execute successfully.
    My code goes like this.
        0            10            20           30           40            50
    1  CREATE OR REPLACE PROCEDURE SEND_TABLE_DATA( FROMAD IN VARCHAR2,
    2   TOAD IN VARCHAR2,
    3   SUBJECT IN VARCHAR2,
    4   MESSAGE IN VARCHAR2,
    5   DOCID IN VARCHAR2,
    6   DOCDT IN DATE,
    7   PRODOAID IN NUMBER )
    8   AS
    9   BATCHNO  VARCHAR2(32767);
    10  PCSBOX  NUMBER;
    11  AMOUNT  NUMBER;
    12  SMTPHOST VARCHAR2(255) := 'XXX.XXX.X.XXX' ;
    13  A UTL_SMTP.CONNECTION ;
    14  BEGIN
    15  A :=UTL_SMTP.OPEN_CONNECTION(SMTPHOST,25);
    16  UTL_SMTP.HELO(A,SMTPHOST);
    17  UTL_SMTP.MAIL(A,FROMAD);
    18  UTL_SMTP.RCPT(A,TOAD);
    19  UTL_SMTP.OPEN_DATA(A);
    20  UTL_SMTP.WRITE_DATA(A, CHR(13) ||CHR(13) || CHR(13) );
    21  UTL_SMTP.WRITE_DATA (A,'Date: '|| TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') || CHR(13) );
    22  UTL_SMTP.WRITE_DATA(A,'From: '||FROMAD|| CHR(13) );
    23  UTL_SMTP.WRITE_DATA(A, 'To: '||TOAD|| CHR(13) );
    24  UTL_SMTP.WRITE_DATA(A, 'Subject: '|| SUBJECT || CHR(13) );
    25  UTL_SMTP.WRITE_DATA(A,MESSAGE||DOCID||' Documented on '||DOCDT||CHR(13) );
    26  UTL_SMTP.WRITE_DATA(A,CHR(13) || CHR(13) || CHR(13) );
    27  UTL_SMTP.WRITE_DATA(A,'This is for your information'||CHR(13) );
    28  UTL_SMTP.WRITE_DATA (A,' BATCHNO '|| ' -- '||' PCSBOX '||' -- '||' AMOUNT '||CHR(13) );
    29  EXECUTE IMMEDIATE
    30         'SELECT
    31       A.BATCHNO,B.PCSBOX,B.AMOUNT
    32        FROM
    33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
    34        WHERE
    35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
    36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
    37  FOR indx IN 1..BATCHNO.COUNT
    38   LOOP
    39    UTL_SMTP.WRITE_DATA (A,BATCHNO(indx)|| ' -- '||PCSBOX(indx)||' -- '||AMOUNT(indx)||CHR(13) );
    40   END LOOP;
    41  UTL_SMTP.WRITE_DATA( A,CHR(13) || CHR(13) || CHR(13) );
    42  UTL_SMTP.CLOSE_DATA(A);
    43  UTL_SMTP.QUIT(A);
    44  EXCEPTION
    45  WHEN OTHERS THEN
    46  UTL_SMTP.QUIT(A);
    47  RAISE;
    48  END;
    49  /
    SELECT * FROM USER_ERRORS
    NAME                       TYPE             SEQUENCE    LINE         POSITION        TEXT                                                                                                             ATTRIBUTE                 MESSAGE_NUMBER
    SEND_TABLE_DATA
    PROCEDURE
    3
    37
    1
    PL/SQL: Statement ignored
    ERROR
    0
    SEND_TABLE_DATA
    PROCEDURE
    2
    37
    24
    PLS-00487: Invalid reference to variable 'BATCHNO'
    ERROR
    487
    SEND_TABLE_DATA
    PROCEDURE
    1
    36
    25
    PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list
    ERROR
    497
    Thanks In Advance
    Regards
    Pradeep.

    > 29  EXECUTE IMMEDIATE
    > 30         'SELECT
    > 31       A.BATCHNO,B.PCSBOX,B.AMOUNT
    > 32        FROM
    > 33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
    > 34        WHERE
    > 35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
    > 36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
    The variables BATCHNO, PCSBOX and AMOUNT are defined as scalar variables. Check there definition
    > 9   BATCHNO  VARCHAR2(32767);
    > 10  PCSBOX  NUMBER;
    > 11  AMOUNT  NUMBER;
    You cannot use BULK COLLECT on scalar variables. The variables must be defined as a COLLECTION TYPE in order to perform bulk collect.

  • __Is there a way to make a multi-layer Ai file into a multi-page PDF? (1 layer per page)

    __Is there a way to make a multi-layer Ai file into a multi-page PDF? (1 layer per page)
    thanks

    Definitely can be done.
    In CS 4 you create an artboard for each page and the position the art for the corresponding page on the corresponding artboard and make a layer for that art. This way it does not even matter if the layer s are properly layered when saving the pdf. Just as long as the artboards are.
    CS 3 and earlier  back a larger document that can be divided into whole pages by turning on tiling and using the page tool position that art.
    Position the art for each page over the designated artboard make a layer for each pages art now when you export the with tiling on and you wll get a multi page pdf.

  • How can I turn my French apple account into Australian one to be able to buy a Iphoto book I've made?

    hi
    How can I turn my french apple account into an Australian one , to be able to buy a Iphoto book I 've created ?

    And you need to set the "Print Products Store" in the iPhoto Preferences "Advanced" to the country you are in. The credit card you will be using with your AppleID needs to be valid in the country your AppleID is registered to. Will you be staying permanently in Australia? Maybe it wuld be simpler to create a second AppleID just for the time of your stay there.

  • How do you turn third-party midi loops into Apple Loops?

    Does anyone know how to turn third-party midi loops into Apple Loops? I've got hundreds of short midi files that I purchased, and I would like to be able to use them in the loop browser of Logic Studio. I tried some of the obvious ways of doing this, like using Apple Loop Utility, but it doesn't seem to recognize .mid files. Seems like .mid files would be right up its alley, so maybe I'm doing something wrong...

    Yes, have the same problem but with wav loops. i have 75000 wav loops from third part and do not find how to "logicized" it. For the moment i can use them into a project but they are not adapting when i change the bpm of the projetc for exemple.
    If you know the solution i would be rescued

  • Yesterday I was pushed into the sea with my Iphone 5s in my back pocket, as I got out I took my phone out of my pocket and it turned itself off. I have tried many ways but still is unsuccessful and wont turn on, what shall I do?

    I was pushed into the sea with my iphone 5s in my back pocket, I got out and pulled my phone out of my back pocket and it turnt itself off. I went straight home and tried using a hair dryer but was unsucessful, put it in rice which also failed and i left it screen up on the radiator over night but still wouldnt turn on. It has charge on it although i still tried plugging it in to give it power and still was unable to power up. Can anyone give any suggestions on how i can fix it as for its not even 2 months old.

    Watamu wrote:
    Try putting it in rice for a few hours. It does sound daft but it did work for mine
    If you're going to put a phone in rice (not daft at all, the rice acts as a dessicant), it needs to be for a few days, not a few hours. The OP stated in their post that the did put it in rice. In addition to the liquid damage, salt water is also much more corrosive to electronics than plain water. The rice won't help with the salt.

  • Any way to import multi-layered Illustator file into Motion?

    I have an Illustrator map of Europe and i would like to bring it into Motion.
    I know that Motion can import Illustrator files as pdf but is there any way to import a multi-layered illustrator file into Motion. I just saw this web site regarding a Motion plug-in that claims to do just this:
    http://www.macupdate.com/info.php/id/16298/layerlink

    Without a dedicated plug or FxPlug, Motion has no inherent ability to parse Illustrator layers.
    We just bust the layers out and save them as individual files. Or, of course, we use After Effects.
    bogiesan

  • How can I reset my iPad when someone else has signed into there icloud account and i dont know there password to sign out

    I let someone borrow my ipad and they have since gone back overseas. The problem I have is they are still signed into the icloud with there user name and password and i cant reset my iPad because of this.
    Is there away I can reset it

    Activation Lock
    Find My iPhone Activation Lock- Removing a device from a previous owner’s account
    Unless you can get your friend to turn off Find My Phone and erase it for you, then you cannot ever use it again.

  • How can I turn my Mac using iTunes into an alarm clock?

    Here's my question: How can I turn my Mac, using iTunes, into an alarm clock?
    I want to be able to put my Mac to sleep but have it set up so that when it wakes up at the predetermined time iTunes will open and start playing the music I've selected....
    A "musical alarm clock"...
    A friend suggested using the Energy Saver option in Sys. Preferences to wake the computer at the right time. He said that then I could use iCal to start iTunes. I would then have to use an Apple Script to get iTunes to play the song I want.
    But is there a SIMPLER way to do this? Are there any programs out there that do this already??
    Thanks for any help....

    I recently got a copy of AlarmClock Pro from MacWorld UK. It is shareware, I think it is (USD?)19. I haven't had a chance to try it out much, but it does look quite good. I have an older version. The latest version looks even better.
    I'm sure there's plenty of freeware apps out there. You might also want to try looking here for an applescript here Doug's AppleScripts for iTunes
    p53

Maybe you are looking for

  • "iTunes could not connect to the Music Store" Error Message

    Hello all, I finally got my script running correctly and I can see the front page of my iTunesU site(Yay!). But I am getting an irritating error message, and what is unusual are the circumstances under which I see the error message and the circumstan

  • 7.7 Not really 64 bit?

    I've downloaded what is in theory the version of iTunes for 64-bit Vista. However, when I go to install it, the target directory is "C:\Program Files(x86)\iTunes". This is the default location for 32-bit applications. The "(x86)" should not be there

  • Report group

    Dear experts,    I have a t-code 'ZF31'  when I see the status of this tcode the program name is showing like '<b>GP3NRV9GORPNJR0V3473BDOGINU250</b>'  in client 250.    When I execute the same program in client the 050 the program is not running sayi

  • Calling an ABAP Report from GRC Portal

    Hello... we want to know how an ABAP report will be called from GRC Portal ? How will be the linkage between these two and can u please explain the same . Thanks in advance. Regards, KY.

  • WEBSHOP & IC WEBCLIENT

    Hi   Is there is any way to track the Activities( like Address change) of ISA ( b2c) Application in <b>Activity management.</b> <u>Need to Display the Activities( changes in ISA) in WEB IC as well as CRM Online.</u> Usefulful answers will be Rewarded