Assistance Needed With Creating a Dynamic Query

I am attempting to rename several of my primary key/foreign key constraints from the default "SYS" names to something actually meaningful. I have several "semi-dynamic" queries that look something like this:
SELECT 'ALTER TABLE L_ROLE RENAME CONSTRAINT ' || CONSTRAINT_NAME || ' TO NN_ROLE_ID; ' FROM USER_CONSTRAINTS WHERE CONSTRAINT_TYPE ='C' AND TABLE_NAME='L_ROLE' AND search_cond(constraint_name)='"ID" IS NOT NULL';
Unfortunately, I have to capture the output of this script and run THOSE statements to get anything done.
I would like to convert this to simply use EXECUTE IMMEDIATE or if necessary a stored procedure. Unfortunately, I'm a bit confused on what the end result would look like. Any assistance would be appreciated.
Jason
p.s."search_cond" is a custom function defined as follows:
create function search_cond( p_cons_name in varchar2 ) return varchar2
as
l_search_condition varchar2(4000);
begin
     select SEARCH_CONDITION into l_search_condition
     from user_constraints
     where constraint_name = p_cons_name;
return l_search_condition;
end;
For some reason, just running the query outside the function doesn't work.

OK, try this. Please note that I commented out the actual exec immediate line and instead just dbms_output the commands that will get executed. This way you can try this first to make sure it produces what you expect. Then just put the exec immediate back in when you are ready.
DECLARE
    TYPE cur_typ IS REF CURSOR;
    v_cursor cur_typ;
    v_query VARCHAR2(1000);
    v_exec VARCHAR2(1000);
BEGIN
    v_query := 'SELECT ''ALTER TABLE ''||uc.table_name||''  RENAME CONSTRAINT '' || uc.constraint_name ||
                      '' TO NN_''||ucc.column_name||'' '' thequery
                FROM  user_constraints uc,
                      user_cons_columns ucc
                WHERE uc.constraint_name = ucc.constraint_name
                AND   uc.constraint_type =''C''
                AND   search_cond(uc.constraint_name)=''"ID" IS NOT NULL''
                AND   uc.constraint_name LIKE ''SYS%'' ';
    DBMS_OUTPUT.PUT_LINE(v_query);
    OPEN v_cursor FOR v_query;
    LOOP
        FETCH v_cursor INTO v_exec;
        EXIT WHEN v_cursor%NOTFOUND;
        --EXECUTE IMMEDIATE (v_exec);
        dbms_output.put_line(v_exec);
    END LOOP;
    CLOSE v_cursor;   
END;
/Greg

Similar Messages

  • Create a dynamic query with or/and

    Hello!
    Please help to accomplish the following:
    User needs to create a dynamic query.
    There are few select lists: sex, race, state …
    User selects whatever he needs from select lists, which would become the first part of the “where clause” – i.e. (sex = ‘M’ AND state = ‘NY’).
    Then the user wants to add an additional condition using “OR/AND” – i.e. i.e. (sex = ‘M’ AND state = ‘NY’) OR (sex = ‘F’).
    I have been able to build the first clause and pass to a variable. I need to be able to clear the values in the select lists, but keep the value stored in the variable, and then append each new clause to the variable. This needs to be event driven by an item on the page.
    Any help is appreciated.
    Thank you in advance.

    Hi,
    At that point my application works fine.
    But I need to add ability to clear select lists and enter a new condition with 'OR'
    operator.
    The final SQL statement should look:
    select employee_id, name from employee_v where (sex = ‘M’ AND state = ‘NY’) OR (sex = ‘F’)
    Thank you.

  • Need to create an ABAP query on 2 tables BSIK and BSAK

    Hi,
      I need to create an ABAP query which has the fields document no, doc date, amount in doc currency and some other fields from 2 tables BSIK and BSAK. Is it possible to write a single abap query to fetch the data from both the tables.
    The selection screen fields are doc number, date and doc type.
      I need to display invoices for open items and cleared items together.
      Please let me know if this is possible.
    Thanks and Regards,
    Ajith

    See if this is anything like what you need:
    REPORT ztest MESSAGE-ID 00.
    TABLES: bkpf, bseg.
    SELECT-OPTIONS: s_bukrs FOR bkpf-bukrs,
                    s_belnr FOR bkpf-belnr,
                    s_gjahr FOR bkpf-gjahr,
                    s_blart FOR bkpf-blart,
                    s_budat FOR bkpf-budat.
    DATA: BEGIN OF bkpf_int OCCURS 0.
            INCLUDE STRUCTURE bkpf.
    DATA: END   OF bkpf_int.
    DATA: BEGIN OF bseg_int OCCURS 0.
            INCLUDE STRUCTURE bseg.
    DATA: END   OF bseg_int.
    DATA: BEGIN OF bsik_int OCCURS 0.
            INCLUDE STRUCTURE bsik.
    DATA: END   OF bsik_int.
    SELECT  *
      FROM  bkpf
      INTO  TABLE bkpf_int
      WHERE bukrs  IN s_bukrs
        AND belnr  IN s_belnr
        AND gjahr  IN s_gjahr
        AND blart  IN s_blart
        AND bldat  IN s_budat.
    SORT bkpf_int BY bukrs belnr gjahr.
    SELECT  *
      FROM  bseg
      INTO  TABLE bseg_int
      FOR ALL ENTRIES IN bkpf_int
      WHERE bukrs = bkpf_int-bukrs
        AND belnr = bkpf_int-belnr
        AND gjahr = bkpf_int-gjahr
        AND koart = 'K'.
    SORT bseg_int BY bukrs belnr gjahr buzei.
    LOOP AT bseg_int.
      MOVE-CORRESPONDING bseg_int TO bsik_int.
      READ TABLE bkpf_int WITH KEY
        bukrs = bseg_int-bukrs
        belnr = bseg_int-belnr
        gjahr = bseg_int-gjahr
        BINARY SEARCH.
      IF sy-subrc = 0.
        MOVE-CORRESPONDING bkpf_int TO bsik_int.
        APPEND bsik_int.
      ELSE.
        MESSAGE e001 WITH 'Error during read'.
      ENDIF.
    ENDLOOP.
    Rob

  • Problem with creating an dynamic internal table with only one field.

    Hi,
    i create an internal table like this:
    FIELD-SYMBOLS: <GT_ITAB>      TYPE TABLE,
                   <GS_ITAB>,
                   <FS>.
    DATA: GT_DATA TYPE REF TO DATA.
    DATA: GS_DATA TYPE REF TO DATA.
    DATA: TABNAME   LIKE DD03L-TABNAME.
    DATA: FIELDNAME LIKE DD03L-FIELDNAME.
    DATA: TBFDNAM   TYPE TBFDNAM VALUE 'LFA1-NAME1'.
    SPLIT TBFDNAM AT '-' INTO TABNAME FIELDNAME.
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    ASSIGN GT_DATA->* TO <GT_ITAB>.
    CREATE DATA GS_DATA  LIKE LINE OF <GT_ITAB>.
    ASSIGN GS_DATA->* TO <GS_ITAB>.
    SELECT * FROM (TABNAME) INTO CORRESPONDING FIELDS OF TABLE <GT_ITAB>.
      BREAK-POINT.
    it works OK.
    Now i want to create an internal table not like LFA1 but with LFA1-NAME1 Field TBFDNAM.
    It's not only LFA1-NAME1 it shell be the value of TBFDNAM.
    When i change
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    to
    CREATE DATA GT_DATA TYPE TABLE OF ( TBFDNAM).
    i get an shortdump.
    Any idea?
    Regards, Dieter

    Hi Dieter,
    Your approach is ok, but it will create dynamic table without a structure of NAME1. Only the line type will be suitable (but field name will not exists -> hence the error in the select statement).
    In this case you need to create a dynamic table which structure consists of one field named NAME1.
    This code is the appropriate one:
    " your definitions
    DATA: tabname LIKE dd03l-tabname.
    DATA: fieldname LIKE dd03l-fieldname.
    DATA: tbfdnam TYPE tbfdnam VALUE 'LFA1-NAME1'.
    FIELD-SYMBOLS <gt_itab> TYPE table.
    "new ones
    DATA: it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
    DATA: gt_itab TYPE REF TO data.
    " get table and fieldname
    SPLIT tbfdnam AT '-' INTO tabname fieldname.
    " create dynamic table with structure NAME1 (only one field)
    it_fcat-fieldname = fieldname.
    it_fcat-tabname = tabname.
    APPEND it_fcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = it_fcat[]
      IMPORTING
        ep_table                  = gt_itab
      EXCEPTIONS
        generate_subpool_dir_full = 1
        OTHERS                    = 2.
    CHECK sy-subrc = 0.
    " dereference table
    ASSIGN gt_itab->* TO <gt_itab>.
    " insert data only to NAME1 field
    SELECT * FROM (tabname) INTO CORRESPONDING FIELDS OF TABLE <gt_itab>.
    I checked, this works fine:)
    Regards
    Marcin

  • Need to create at BEX Query to get last 30 days data.

    Hi,
    I need to create a bex query based on input date need to calculate last 30 days outstanding and 31-60 days outstanding 61-90 days outstanding 91-180 days outstanding and greater than 180 days outstanding. Please find the format of the report.Kindly help me.
                                                                                                                          Thanks & Regards,

    Based on those documents you can easily create.
    1. First create variable (Mandatory) user input
    2. Posting date is avaialble as char you will get
    3. need to calcualte difference b/w those 2 dates  you can refer below  By using replacement path we can convert both dates into get difference.
    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    4. now need to create  Bucketing logic  formula  as per requirement above documents will give idea.

  • Help needed on creating a SAP query

    Hi All,
    Can somebody give me the step by step procedures of creating a SAP query and Infoset.
    My requirement is to display asset master details with Asset number or Asset class as input.
    Any pointers or links to create an infoset and query will br highly helpful.
    Thanks,
    Arun

    Here are couple of fields you might be needed :
    AGKO     Cleared Accounts
    ANAR     Asset Types
    ANAT     Asset type text
    ANEK     Document Header Asset Posting
    ANEP     Asset Line Items
    ANEV     Asset downpymt settlement
    ANKT     Asset classes- Description
    ANLA     Asset Master Record Segment
    ANLB     Depreciation terms
    ANLC     Asset Value Fields
    ANLH     Main asset number
    AT02T     Transaction Activity Category- Description
    AT02A     Transaction Code for Menu TIMN
    AT10     Transaction type
    AT10T     Name of Transaction Type
    BKDF     Document Header Supplement for Recurring Entry
    BKORM     Accounting Correspondence Requests
    BKPF     Accounting Document Header
    BLPK     Document log header
    BLPP     Document log item
    BLPR     Document Log Index and Planned Order (Backflush)
    BNKA     Bank master record
    BP000     Business Partner Master (General Data)
    BPBK     Doc.Header Controlling Obj.
    BPEG     Line Item Total Values Controlling Obj.
    BPEJ     Line Item Annual Values Controlling Obj.
    BPEP     Line Item Period Values Controlling Obj.
    BPGE     Totals Record for Total Value Controlling obj.
    BPJA     Totals Record for Annual Total Controlling Obj.
    BSAD     Accounting- Secondary Index for Customers (Cleared Items)
    BSAK     Accounting- Secondary Index for Vendors (Cleared Items)
    BSAS     Accounting- Secondary Index for G/L Accounts (Cleared Items)
    BSEC     One-Time Account Data Document Segment
    BSEG     Accounting Document Segment
    BSID     Accounting- Secondary Index for Customers
    BSIK     Accounting- Secondary Index for Vendors
    BSIM     Secondary Index, Documents for Material
    BSIS     Accounting- Secondary Index for G/L Accounts
    CEPC     Profit Center Master Data Table
    CEPCT     Texts for Profit Center Master Data
    COBRA     Settlement Rule for Order Settlement
    COBRB     Distribution Rules Settlement Rule Order Settlement
    COKA     CO Object- Control Data for Cost Elements
    COSP     CO Object- Cost Totals for External Postings
    COSS     CO Object- Cost Totals for Internal Postings
    CRCO     Assignment of Work Center to Cost Center
    CSKA     Cost Elements (Data Dependent on Chart of Accounts)
    CSKB     Cost Elements (Data Dependent on Controlling Area)
    CSLA     Activity master
    FEBEP     Electronic Bank Statement Line Items
    FPLA     Billing Plan
    FPLT     Billing Plan- Dates
    GLPCT     EC-PCA- Totals Table
    KNA1     General Data in Customer Master
    KOMK     Pricing Communication Header
    MAHNV     Management Records for the Dunning Program
    REGUT     TemSe - Administration Data
    SKA1     G/L Account Master (Chart of Accounts)
    SKAT     G/L Account Master Record (Chart of Accounts- Description)
    SKB1     G/L account master (company code)
    T003T     Document Type Texts
    T007S     Tax Code Names
    T087J     Text
    TAPRFT     Text tab. for investment profile
    TKA01     Controlling Areas
    TKA09     Basic Settings for Versions
    TKVS     CO Versions
    TZB0T     Flow types text table
    TZPAT     Financial Assets Management product type texts
    VBSEGS     Document Segment for G/L Accounts Document Parking
    VTBFHA     Transaction
    VTBFHAPO     Transaction Flow
    VTBFHAZU     Transaction Activity
    VTBFINKO     Transaction Condition
    VTIDERI     Master Data Listed Options and Futures
    VTIFHA     Underlying transaction
    VTIFHAPO     Underlying transaction flows
    VTIFHAZU     Underlying transaction status table
    VTIOF     Options Additional Data
    VWPANLA     Asset master for securities

  • Help needed with creating Flash game

    Hello,
    I need to create Flash educational/quiz game for one of my clients. It would be based on concept like these ones for example:
    Example 1
    http://go.ucsusa.org/game/
    Example 2
    http://www.zdravlje.hr/igre/stop-aids/
    Note: when you open this link you will see two text boxs which you first must fill. On the left side text box "Upišite ime" means "Type your name" and right one "Upišite godinu svog rođenja" means "Year of birth"
    What is interesting about this type of games is that they are classic games (for example game Labirint where you have to find way out), but during play pop-up questions starts to appear to test end user knowledge abot certain topic (in example 2 topic is about AIDS/HIV). In case of my client, topic is about Eco environment.
    Here is where my trouble starts;) : I found many useful free tutorials how to create simple flash game (most interesting example I found is this one http://www.strille.net/tutorials/snake/index.php)  BUT I dont know how make that system of popup questions appear during game similar to Example 1 and Example 2?
    Any help is appreciated and thanks in advance for promt reply.
    Greetings,
    Adnan

    Update: I have just read all instructions in Snake tutorial which helped be better realize how Snake game works.
    a) This is what I plan to realize for my client:
    1. Snake game which end users will play and during play pop-up/quiz quesions will appear on topic Eco environment;
    2. For example when end user earns 50 points he must answer some of the random questions like "Q:How many ton of waste are produced by US livestock each year" with three answers A1: "1 milion" A2: "1 bilion" A3: "2 bilion" and after user scores 100 points then another question pops up and so on. This is all true if all answers are correct but in case he answer some question wrong than game can start from begining or another solution could be he looses -50 or -100 points.
    3. At the end, user which gains most points wins.
    b) This is what I have done till now:
    I have this file http://www.strille.net/tutorials/snake/snakeGameWithHighscore.zip which I partly understand how it works with my Flash knowladge.
    All functions and main game engine is in layer code:
    "// Snake Game by Strille, 2004, www.strille.net
    blockSize = 8;   // the block width/height in number of pixels
    gameHeight = 30; // the game height in number of blocks
    gameWidth  = 45; // the game width in number of blocks
    replaySpeed = 1;
    SNAKE_BLOCK = 1; // holds the number used to mark snake blocks in the map
    xVelocity = [-1, 0, 1, 0]; // x velocity when moving left, up, right, down
    yVelocity = [0, -1, 0, 1]; // y velocity when moving left, up, right, down
    keyListener = new Object(); // key listener
    keyListener.onKeyDown = function() {
        var keyCode = Key.getCode(); // get key code
        if (keyCode > 36 && keyCode < 41) { // arrow keys pressed (37 = left, 38 = up, 39 = right, 40 = down)...
            if (playRec) {
                if (keyCode == 37 && replaySpeed > 1) {
                    replaySpeed--;
                } else if (keyCode == 39 && replaySpeed < 10) {
                    replaySpeed++;
            } else if (game.onEnterFrame != undefined) { // only allow moves if the game is running, and is not paused
                if (keyCode-37 != turnQueue[0]) { // ...and it's different from the last key pressed
                    turnQueue.unshift(keyCode-37); // save the key (or rather direction) in the turnQueue
        } else if (keyCode == 32) { // start the game if it's not started (32 = SPACE)
            if (!gameRunning || playRec) {
                startGame(false);
        } else if (keyCode == 80) { // pause/unpause (80 = 'P')
            if (gameRunning && !playRec) {
                if (game.onEnterFrame) { // pause
                    delete game.onEnterFrame; // remove main loop
                    textMC.gotoAndStop("paused");
                } else { // exit pause mode
                    game.onEnterFrame = main; // start main loop
                    textMC.gotoAndStop("hide");
    Key.addListener(keyListener);
    function startGame(pRec) {
        x = int(gameWidth/2); // x start position in the middle
        y = gameHeight-2;     // y start position near the bottom
        map = new Array(); // create an array to store food and snake
        for (var n=0;n<gameWidth;n++) { // make map a 2 dimensional array
            map[n] = new Array();
        turnQueue = new Array(); // a queue to store key presses (so that x number of key presses during one frame are spread over x number of frames)
        game.createEmptyMovieClip("food", 1); // create MC to store the food
        game.createEmptyMovieClip("s", 2); // create MC to store the snake
        scoreTextField.text = "Score: 0"; // type out score info
        foodCounter = 0; // keeps track of the number of food movie clips
        snakeBlockCounter = 0; // keeps track of the snake blocks, increased on every frame
        currentDirection = 1; // holds the direction of movement (0 = left, 1 = up, 2 = right, 3 = down)
        snakeEraseCounter = -1; // increased on every frame, erases the snake tail (setting this to -3 will result in a 3 block long snake at the beginning)
        score = 0; // keeps track of the score
        ticks = lastRec = 0;
        recPos = recFoodPos = 0;
        playRec = pRec;
        if (!playRec) {
            textMC.gotoAndStop("hide"); // make sure no text is visible (like "game over ")
            highscores.enterHighscoreMC._visible = false;
            statusTextField.text = "";
            recTurn = "";
            recFrame = "";
            recFood = "";
            game.onEnterFrame = main; // start the main loop
        } else {
            if (loadedRecordingNumber != -1) {
                var n = getLoadedRecordingNumberHighscorePos(loadedRecordingNumber);
                statusTextField.text = "Viewing " + highscores[n].name.text + "'s game (score " + highscores[n].score.text + ")";
            } else {
                statusTextField.text = "Viewing your game";
            game.onEnterFrame = replayMain; // start the main loop
        placeFood("new"); // place a new food block
        gameRunning = true; // flag telling if the game is running. If true it does not necessarily mean that main is called (the game could be paused)
    function main() { // called on every frame if the game is running and it's not paused
        if (playRec) {
            if (ticks == lastRec+parseInt(recFrame.charAt(recPos*2)+recFrame.charAt(recPos*2+1), 36)) {
                currentDirection = parseInt(recTurn.charAt(recPos));
                lastRec = ticks;
                recPos++;
        } else if (turnQueue.length) { // if we have a turn to perform...
            var dir = turnQueue.pop(); // ...pick the next turn in the queue...
            if (dir % 2 != currentDirection % 2) { // not a 180 degree turn (annoying to be able to turn into the snake with one key press)
                currentDirection = dir; // change current direction to the new value
                recTurn += dir;
                var fn = ticks-lastRec;
                if (fn < 36) {
                    recFrame += " "+new Number(fn).toString(36);
                } else {
                    recFrame += new Number(fn).toString(36);
                lastRec = ticks;
        x += xVelocity[currentDirection]; // move the snake position in x
        y += yVelocity[currentDirection]; // move the snake position in y
        if (map[x][y] != SNAKE_BLOCK && x > -1 && x < gameWidth && y > -1 && y < gameHeight) { // make sure we are not hitting the snake or leaving the game area
            game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x: x*blockSize, _y: y*blockSize}); // attach a snake block movie clip
            snakeBlockCounter++; // increase the snake counter
            if (map[x][y]) { // if it's a not a vacant block then there is a food block on the position
                score += 10; // add points to score
                scoreTextField.text = "Score: " + score; // type out score info
                snakeEraseCounter -= 5; // make the snake not remove the tail for five loops
                placeFood(map[x][y]); // place the food movie clip which is referenced in the map map[x][y]
            map[x][y] = SNAKE_BLOCK; // set current position to occupied
            var tailMC = game.s[snakeEraseCounter]; // get "last" MC according to snakeEraseCounter (may not exist)
            if (tailMC) { // if the snake block exists
                delete map[tailMC._x/blockSize][tailMC._y/blockSize]; // delete the value in the array m
                tailMC.removeMovieClip(); // delete the MC
            snakeEraseCounter++; // increase erase snake counter   
        } else { // GAME OVER if it is on a snake block or outside of the map
            if (playRec) {
                startGame(true);
            } else {
                gameOver();
            return;
        ticks++;
    function replayMain() {
        for (var n=0;n<replaySpeed;n++) {
            main();
    function gameOver() {
        textMC.gotoAndStop("gameOver"); // show "game over" text
        delete game.onEnterFrame; // quit looping main function
        gameRunning = false; // the game is no longer running
        enterHighscore();
    function placeFood(foodMC) {
        if (playRec) {
            var xFood = parseInt(recFood.charAt(recFoodPos*3)+recFood.charAt(recFoodPos*3+1), 36);
            var yFood = parseInt(recFood.charAt(recFoodPos*3+2), 36);
            recFoodPos++;
        } else {
            do {
                var xFood = random(gameWidth);
                var yFood = random(gameHeight);
            } while (map[xFood][yFood]); // keep picking a spot until it's a vacant spot (we don't want to place the food on a position occupied by the snake)
            if (xFood < 36) {
                recFood += " "+new Number(xFood).toString(36);
            } else {
                recFood += new Number(xFood).toString(36);
            recFood += new Number(yFood).toString(36);
        if (foodMC == "new") { // create a new food movie clip
            foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
            foodCounter++;
        foodMC._x = xFood*blockSize; // place the food
        foodMC._y = yFood*blockSize; // place the food
        map[xFood][yFood] = foodMC; // save a reference to this food movie clip in the map
    //- Highscore functions
    loadHighscores();
    enterHighscoreKeyListener = new Object();
    enterHighscoreKeyListener.onKeyDown = function() {
        if (Key.getCode() == Key.ENTER) {
            playerName = highscores.enterHighscoreMC.nameTextField.text;
            if (playerName == undefined || playerName == "") {
                playerName = "no name";
            saveHighscore();
            Key.removeListener(enterHighscoreKeyListener);
            Key.addListener(keyListener);
            highscores.enterHighscoreMC._visible = false;
            loadedRecordingNumber = -1;
            startGame(true);
    function enterHighscore() {
        if (score >= lowestHighscore) {
            highscores.enterHighscoreMC._visible = true;
            highscores.enterHighscoreMC.focus();
            Key.removeListener(keyListener);
            Key.addListener(enterHighscoreKeyListener);
        } else {
            loadedRecordingNumber = -1;
            startGame(true);
    function getLoadedRecordingNumberHighscorePos(num) {
        for (var n=0;n<10;n++) {
            if (num == highscores[n].recFile) {
                return n;
    function loadHighscores() {
        vars = new LoadVars();
        vars.onLoad = function(success) {
            for (var n=0;n<10;n++) {
                var mc = highscores.attachMovie("highscoreLine", n, n);
                mc._x = 5;
                mc._y = 5+n*12;
                mc.place.text = (n+1) + ".";
                mc.name.text = this["name"+n];
                mc.score.text = this["score"+n];
                mc.recFile = parseInt(this["recFile"+n]);
            lowestHighscore = parseInt(this.score9);
            if (!gameRunning) {
                loadRecording(random(10));
            delete this;
        if (this._url.indexOf("http") != -1) {
            vars.load("highscores.txt?" + new Date().getTime());
        } else {
            vars.load("highscores.txt");
    function loadRecording(num) {
        vars = new LoadVars();
        vars.onLoad = function(success) {
            if (success && this.recTurn.length) {
                recTurn = this.recTurn;
                recFrame = this.recFrame;
                recFood = this.recFood;
                startGame(true);
            } else {
                loadRecording((num+1)%10);
                return;
            delete this;
        loadedRecordingNumber = num;
        if (this._url.indexOf("http") != -1) {
            vars.load("rec"+loadedRecordingNumber+".txt?" + new Date().getTime());
        } else {
            vars.load("rec"+loadedRecordingNumber+".txt");
    function saveHighscore() {
        sendVars = new LoadVars();
        for (var n in _root) {
            if (_root[n] != sendVars) {
                sendVars[n] = _root[n];
        returnVars = new LoadVars();
        returnVars.onLoad = function() {
            if (this.status == "ok") {
                loadHighscoresInterval = setInterval(function() {
                    loadHighscores();
                    clearInterval(loadHighscoresInterval);
                }, 1000);
            delete sendVars;
            delete this;
        sendVars.sendAndLoad("enterHighscore.php", returnVars, "POST");
    function startClicked() {
        if (!gameRunning || playRec) {
            if (highscores.enterHighscoreMC._visible) {
                Key.removeListener(enterHighscoreKeyListener);
                Key.addListener(keyListener);
                highscores.enterHighscoreMC._visible = false;
            startGame(false);
    function viewGame(lineMC) {
        loadRecording(lineMC.recFile);
        statusTextField.text = "Loading " + lineMC.name.text + "'s game...";
    Now what is left to do is somehow to iclude educational quiz in this game/code. First idea that came to me is same thing Ned suggested: to create some unique movie clip which would contain all data/questions lined up but main problem for me is how to "trigger" that movie clip to play only AFTER end user clicks on "Start game" or SPACE to restart? Not sure how to solve this issue?

  • Help needed in creating a dynamic poplist

    Hi,
    Can anybody please tell me how to create a dynamic poplist.
    Can we create a dynamic poplist without using any controller code.
    I have created a simple poplist for "Deptno".
    Now I want to create a dynamic poplist for "Empname" , Which should be based on the 'Deptno' poplist entry.
    When I select a department number from Deptno poplist, All the employees names under that perticular department should appear in my "Empname" poplist.
    So please suggest me how to create "Empname" dynamic poplist.
    Thanks,
    Swaroop

    see thread:
    How to create dynamic poplist
    --Mukul                                                                                                                                                                                       

  • How to create a dynamic query in which I can vary number of parameters

    I am writing a JDBC connector. I want to write a dynamic query in that. The query should be able to proceed variable number of parameters and also in the where clause the and/or/like parameters I want to place dynamically.
    I can't write store procedures as we just have read only access to Database so I want to do it through query only.
    Please help me out in doing that as I am not able to proceed further without it ...

    Hi,
    Have a luk at :placeholder for IN condition in database adapter

  • Need Help with Creating the SQl query

    Hi,
    SQL query gurus...
    INFORMATION:
    I have two table, CURRENT and PREVIOUS.(Table Defs below).
    CURRENT:
    Column1 - CURR_PARENT
    Column2 - CURR_CHILD
    Column3 - CURR_CHILD_ATTRIBUTE 1
    Column4 - CURR_CHILD_ATTRIBUTE 2
    Column5 - CURR_CHILD_ATTRIBUTE 3
    PREVIOUS:
    Column1 - PREV_PARENT
    Column2 - PREV_CHILD
    Column3 - PREV_CHILD_ATTRIBUTE 1
    Column4 - PREV_CHILD_ATTRIBUTE 2
    Column5 - PREV_CHILD_ATTRIBUTE 3
    PROBLEM STATEMENT
    Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
    I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
    Please help.
    Regards,
    Parag

    Hi,
    The last message was not posted by the same user_name that started the thread.
    Please don't do that: it's confusing.
    Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
    You just have to unpivot that data to get one row for every change, like this:
    WITH     single_row  AS
         SELECT     c.curr_parent
         ,     c.curr_child
         ,     c.curr_child_attribute1
         ,     c.curr_child_attribute2
         ,     c.curr_child_attribute3
         ,     DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
         ,     DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
         ,     DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
         FROM     current_tbl    c
         JOIN     previous_tbl   p     ON  c.curr_parent     = p.prev_parent
                                AND c.curr_child     = p.prev_child
         WHERE     c.curr_child_attribute1     != p.prev_child_attribute1
         OR     c.curr_child_attribute2     != p.prev_child_attribute2
         OR     c.curr_child_attribute3     != p.prev_child_attribute3
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 3
    SELECT     s.curr_parent     AS parent
    ,     s.curr_child     AS child
    ,     CASE     c.n
              WHEN  1  THEN  s.curr_child_attribute1
              WHEN  2  THEN  s.curr_child_attribute2
              WHEN  3  THEN  s.curr_child_attribute3
         END          AS attribute
    ,     c.n          AS attribute_value
    FROM     single_row     s
    JOIN     cntr          c     ON     c.n IN ( s.diff1
                                    , s.diff2
                                    , s.diff3
    ORDER BY  attribute_value
    ,            parent
    ,            child
    ;

  • Need to create a dynamic caption(column name) in a dynamic table

    Hi All,
    I have created dynamic table .But the dynamic column is not showing.I have created two column name that is name and empId .I have tried with following code
    IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"nameCap");
    nameCap.setText("Name");
    tabColumn1.setHeader((IWDCaption)nameCap);
    IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
    addCap.setText("Address");
    tabColumn2.setHeader((IWDCaption)addCap);
    I m getting internal server error...But When i  m comented the above code i can able to see tha dynamic table withput column name..Can anyone help me
    Suman

    Hi
    IWDTableColumn tabColumn1 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"N_Co");
              IWDTableColumn tabColumn2 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"A_Co");
              IWDInputField nameText = (IWDInputField)view.createElement(IWDInputField.class,"N_Text");
              nameText.bindValue(attrib1);
              tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
              IWDInputField addText = (IWDInputField)view.createElement(IWDInputField.class,"A_Text");
              addText.bindValue(attrib2);
              tabColumn2.setTableCellEditor((IWDTableCellEditor)addText);
    <b>I need to see the column name.....</b>
    for that i have written the following code...
    while writting the following code i m getting internal server error
    IWDCaption nameCap = (IWDCaption)view.createElement(IWDCaption.class,"nameCap");
    nameCap.setText("contribution_area");
    tabColumn1.setHeader((IWDCaption)nameCap);
    IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
    addCap.setText("SUM");
    tabColumn2.setHeader((IWDCaption)addCap);

  • Assistance needed with new monitor and printing from LR3

    I just purchased a new IPS monitor.  I have calibrated it using the HP Display assistant that came with it.  It is an HP ZR 22w.  I saved my calibration as a preset  - however - this is not appearing as a profile when I try to select it in the print module.  the checkbox for "include display profiles" is ticked.  If I allow the printer to manage - the pictures are much warmer than on the IPS display.  My printer is a canon mg6120 and I am running windows 7.  I would appreciate any assistance that anyone can provide.  Thank you

    I think the "HP Display assistant" is a software tool, is that right? 
    Ideally with Lightroom, you should use a hardware calibration/profiling tool (Spyder, Eye One, Color Munki etc).  In particular, you need a monitor profile that contains colour space information.  I had a look through the HP Display Assistant user manual, and it appears the software does calibration but it probably doesn't put colour space info in the profile.  It'll be better than nothing, but a hardware tool is better. 
    However:
    I saved my calibration as a preset  - however - this is not appearing as a profile when I try to select it in the print module.  the checkbox for "include display profiles" is ticked.  If I allow the printer to manage - the pictures are much warmer than on the IPS display.  My printer is a canon mg6120 and I am running windows 7
    This is not what you want to do!  The profile that the HP Display Assistant creates is for the monitor, and only for the monitor.  It gets the right white point and tone curve for the monitor.  What you need in the profile drop-down in LR print module is a printer profile, not a monitor profile (except on very special circumstances). 
    I'm not familiar with the MG6120, but when I googled "profiles for canon mg6120" I got a lot of hits, so I assume profiles are available.  It's quite likely that some came with the printer driver, and were installed with the printer software.  When you select "profile" in LR print module (you may well have to go to "Other..." to see them all) then there should be profiles for the printer - possible lots of them - one or more for each paper type.  If they're not there, see the Canon documentation (or google it) to find out how to load them.   
    If you can't find any profiles for the printer, then try using sRGB (or probably it's "sRGB IEC...").  Without colour management, your printer will probably expect sRGB images, so this should be roughly right, but a specific profile for the printer is better.  This is one of those very special circumstances when something other than a printer profile (and sRGB isn't a printer profile) may be better than nothing.

  • I need to create Buttons dynamically Please Help

    I am currently developing a card game. I represent my cards as buttons. But as the player draws more cards from the deck I have to generate buttons dynamically at run-time. I could use arrays of buttons and store new buttons inside that arrays of buttons. But the only problem is I need ActionListener for each of my buttons. How do you create ActionListener for each different dynamically created buttons? Please Help.

    Here is my code. I just do not understand how to create those functions dynamically that functions different each time.
    Here is my code please take a look.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class run108{
    JButton setbutton;
    JButton ButtonUp;
    JButton ButtonDeal;     
    JButton slot1;
    JButton slot2;
    JButton slot3;
    JButton slot4;
    JButton slot5;
    JButton slot6;
    JButton slot7;
    cards[] card = new cards[55];
    public static void main(String[] argv)
         run108 startgui = new run108();
         startgui.createframe();     
    void createframe()
         //Standard of way of creating Frame
         JFrame frame = new JFrame("108");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setLocation(300,200);// Tells the startup position;
         //Adding Panels to the framework
         JPanel panelA = new JPanel();
         panelA.setBackground(Color.white);
         panelA.setLayout(new BoxLayout(panelA,BoxLayout.Y_AXIS));
         JPanel panelB = new JPanel();
         JPanel panelC = new JPanel();
         //Adding buttons with card images
         JLabel label1 = new JLabel("       Set of Cards");
         panelA.add(label1);
         ImageIcon pic1 = new ImageIcon("cards/backd.png");
         setbutton = new JButton(pic1);          
        panelA.add(setbutton);
        ImageIcon picdeal = new ImageIcon("cards/deal.png");
         ButtonDeal = new JButton(picdeal);
         panelA.add(BorderLayout.CENTER, ButtonDeal);
        ButtonDeal.addActionListener(new DealListener());
         JLabel label2 = new JLabel("       Your Target");
         panelA.add(label2);
         ButtonUp = new JButton(pic1);          
        panelA.add(BorderLayout.CENTER, ButtonUp);
        frame.add(BorderLayout.WEST,panelA);
        // Adds 7 initial card slots.
         ImageIcon pic2 = new ImageIcon("cards/backc.png");
         slot1 = new JButton(pic2);
        panelB.add(slot1);          
        slot1.addActionListener(new Slot1Listener());
        slot2 = new JButton(pic2);
        panelB.add(slot2);
        slot2.addActionListener(new Slot2Listener());
         slot3 = new JButton(pic2);
        panelB.add(slot3);
        slot3.addActionListener(new Slot3Listener());
         slot4 = new JButton(pic2);
        panelB.add(slot4);
        slot4.addActionListener(new Slot4Listener());
         slot5 = new JButton(pic2);
        panelB.add(slot5);
        slot5.addActionListener(new Slot5Listener());
         slot6 = new JButton(pic2);
        panelB.add(slot6);
        slot6.addActionListener(new Slot6Listener());
         slot7 = new JButton(pic2);
        panelB.add(slot7);
        slot7.addActionListener(new Slot7Listener());
        frame.add(BorderLayout.CENTER,panelB);
        // This has to be added @ the end to show the components
        //that were added after on. If it is placed before the components
        //the components shall not appear since they sit on the frame
         frame.setSize(600,500);
         frame.setVisible(true);
    class DealListener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot1Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot2Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot3Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot4Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot5Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot6Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    class Slot7Listener implements ActionListener
         public void actionPerformed(ActionEvent event){}
    }

  • Help needed with creating HTML email in Dreamweaver

    Hi everyone, would really appreciate some help with a dilemma or two that I have.
    I have created the following newsletter in Dreamweaver and uploaded it to our website:
    http://www.nova-design.co.uk/sales/000030.html
    Now, when I go into my email mass mailing client (Handymailer) and send a test out, I encounter a couple of problems.
    Firstly, in Outlook when I receive the email, the grey table on the right of the eshot, is crushed and a lot of the single line text is forced to go over two lines...
    Secondly, in Hotmail, the table displays fine, but it does say that "This message is too wide to fit your screen.  Show full message."
    Once I click "Show full message" it displays in full, but I then need to scroll across to the middle of the browser to view the email.
    If I left align the newsletter will this problem be solved?  Or is there a way in Dreamweaver that I can edit the entire page size so that it's not too wide?
    The table is 600px wide so I assumed that any email sent out would shrink to this size.
    Any help would be greatly appreciated!  This is the first full HTML email I have sent out so it's going to be far from perfect!

    mozza34 wrote:
    I need to look into using inline css styles, I have no idea how to so need to read up on those.
    I created a transparent GIF and placed it, but that moves my text down because the image is in the way?  Am I doing that right?
    Make the transparent gif 1px high.
    Is it the links in the right column that go onto two lines? If so that could be because the links are wider than the actual column itself..so you will have to make column wider.
    If you can't sort it, have  a look at the code below, copy and paste into a new Dreamweaver document and test out. Inline css styling is used in the code below. I've masked your email so no spam bots get hold of it.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>
    <body style="background-color: #CCC;">
    <table width="600" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto;">
    <tr>
    <td width="412" style="font-family: arial, helvetica, sans-serif; font-size: 12px; padding: 10px 10px; background-color: #fff; vertical-align: top;">
    <table width="392" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td style="text-align: center;"><img src="http://www.nova-design.co.uk/images/novalogo.jpg" alt="Nova Design" width="208" height="155" align="top" /></td>
    </tr>
    </table>
    <p style="font-size: 16px; font-weight: bold;">September 2011 Update</p>
    <p>Welcome to our September 2011 Newsletter!  Keeping you up to date with all things Nova Design.</p>
    <p><strong>New Addition</strong></p>
    <p>We would like to welcome to our team Kieran Duggal.  Kieran joins us from Schneider Electric and will be placed into a newly created recruitment role within the company.</p>
    <p>With the contracting side of our business growing, Kieran will be looking after all things recruitment.</p>
    <p>If you are currently looking for work in the field of engineering design, or if you are looking to take on contract or permanent design engineers, feel free to contact Kieran for a chat about current possibilities.</p>
    <p> Kieran Duggal - Recruitment Executive<br />
          <a href="mailto:[email protected]" style="color: #000;">
          [email protected]</a><br />
        01384 405 977</p>
        <p><strong>Social Media</strong></p>
        <p>Further expanding our Social Media horizons, we have decided to create a group on LinkedIn.  Here we will be listing current vacancies and allowing people from the engineering world to take part in various discussions.  Please make sure to join our group, as we will be looking to develop it over the coming months.</p>
        <p><strong>Revamped Design Team</strong></p>
        <p>We have recently taken on several enthusiastic, highly skilled graduates.  We feel our current team of design engineers is stronger than ever, with a healthy mix of vast experience and youth.  We are constantly searching for the best engineering talent in order to consistently provide our clients with high quality levels of work.</p>
        <p><strong>Summary</strong></p>
        <p>2011 has been a busy, exciting year so far and long may it continue.  Our clients are what make us, and we would like to thank those of you who have placed business with us in the past.</p></td>
    <td width="158" style="font-family: arial, helvetica, sans-serif; font-size: 12px; padding: 0 10px; background-color: #333; vertical-align: top;"><img src="../images/novalogo.jpg" alt="Nova Design" width="168" height="1" align="top" />
    <p style="color: #fff;">
    <strong>Nova Design Ltd</strong><br />
    Watt House<br />
    Innovation Centre<br />
    Pensnett Trading Estate<br />
    Kingswinford<br />
    West Midlands<br />
    DY6 7YD</p>
    <p style="color: #fff;">T: +44 (0)1384 400 044<br />
    F: +44 (0)1384 400 090</p>
    <p style="color: #fff;">W: <a href="http://www.nova-design.co.uk" style="color: #fff;" target="_blank">www.nova-design.co.uk</a><br />
    E: <a href="mailto:[email protected]" style="color: #fff;">[email protected]</a></p>
    <table width="168" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td style="vertical-align: middle; padding: 7px 0; font-size: 12px;"><a href="http://www.facebook.com/novadesignuk" target="_blank"><img src="http://www.nova-design.co.uk/images/facebook.gif" alt="Facebook" width="25" height="25" align="absmiddle" style="border: none;" /></a> <a href="http://www.facebook.com/novadesignuk" style="color:#fff;" target="_blank">Facebook</a></td>
    </tr>
    <tr>
    <td style="vertical-align: middle; padding: 7px 0; font-size: 12px;"><a href="http://twitter.com/novadesignuk" target="_blank"><img src="http://www.nova-design.co.uk/images/twitter.gif" alt="Twitter" width="25" height="25" align="absmiddle" style="border: none;"/></a> <a href="http://twitter.com/novadesignuk" style="color:#fff;" target="_blank">Twitter</a></td>
    </tr>
    <tr>
    <td style="vertical-align: middle; padding: 7px 0; font-size: 12px;"><a href="http://www.linkedin.com/groups?about=&gid=4002529&trk=anet_ug_grppro" target="_blank"><img src="http://www.nova-design.co.uk/images/linkedin.gif" alt="LinkedIn" width="25" height="25" align="absmiddle" style="border: none;"/></a> <a href="http://www.linkedin.com/groups?about=&gid=4002529&trk=anet_ug_grppro" style="color:#fff;" target="_blank">LinkedIn</a></td>
    </tr>
    <tr>
    <td style="vertical-align: middle; padding: 7px 0; font-size: 12px;"><a href="http://www.nova-design.co.uk/blog/?feed=rss2" target="_blank"><img src="http://www.nova-design.co.uk/images/rss.gif" alt="RSS" width="25" height="25" align="absmiddle" style="border: none;" /></a> <a href="http://www.nova-design.co.uk/blog/?feed=rss2" style="color:#fff;" target="_blank">RSS Feeds</a></td>
    </tr>
    </table></td>
    </tr>
    </table>
    </body>
    </html>

  • Help needed with creating a script

    This is what I try to achieve:
    Creating sequentially numbered files (any files) by dragging the original to a folder.
    It should work like this:
    drag a file ( i.e. myphoto.jpg) to a folder and the script attached to that folder would duplicate the file and number it (myphoto001.jpg)
    I can't get it to work... does anyone know of a ready-made script or is willing to advise on how-to?
    Thanks for feedback.

    Hello
    Here's some script you may try.
    (Copy code from this web page, not from subscribed email text, for I escaped some characters for posting.)
    Broadly speaking, it will do what you wish. But not exactly as you described.
    A few things to note.
    • It will rename file 'image1.jpg' to 'image1.001.jpg', e.g., (note period between 'image1' and '001') in order to make script simple.
    (If the file name is 'image1' without extension, it will be renamed to, e.g., 'image1.001._' by adding dummy extension '_' in order to make script simple and consistent)
    • It will move the file that is drag-n-dropped to the Folder Actioned folder A to an inner sub-folder B and rename the file in B. This is because renaming file in A will trigger the Folder Action, which detects renamed file as newly added file (under OSX), that is problematic.
    • If the following script is used as Folder Action, you'll have to drag-n-drop the file with option key down to copy it to the Folder Actioned folder. Without option key held down, the original file will be moved to the folder.
    (If the source and destination volumes are different, drag-n-drop will copy the file and there will be no need to use option key. E.g. If Folder Actioned folder resides in an external volume and original files are in an internal volume, simple drag-n-drop will copy the files.)
    Please see comments in script for more details.
    Hope this may help.
    H
    --SCRIPT
      Assumptions and behaviours:
        1) The destination folder B where renamed items are stored is in a root folder A.
          • A is determined as the folder where this Folder Action is attached or this droplet resides; and
          • B's name is given as property destinationFolderName in main().
        2) Target file F is moved to B and renamed such that -
          if original name of F is "P.R" (P = name stem, R = extension) and
          the max seq. number in name of the file(s) in B which has the same name stem and extension as F is M,
          F is renamed as "P.Q.R", where Q = M + 1.
          • Number format is given as property numberFormat in main().
          e.g. File named "name1.jpg" will be renamed to "name1.003.jpg",
            if file named "name1.002.jpg" in destination has the max seq. number with the same name stem and extension.
      Usage:
        1) As Folder Action,
          • save this as compiled script and attached it to folder A; and
          • drag-n-drop target files into A and it will move them in folder B and rename them as intended.
          (Use option-drag-n-drop (i.e. copy, not move) to keep the original file or it will be moved and renamed.)
        2) As droplet,
          • save this as application (or application bundle) in folder A; and
          • drag-n-drop target files onto the droplet and it will duplicate them to folder B and rename them as intended.
          (Exception. If target files are in A, they will be moved, not copied, to folder B.)
    on adding folder items to da after receiving aa
    main(da, aa)
    end adding folder items to
    on open aa
    tell application "Finder" to set da to container of (path to me) as alias
    main(da, aa)
    end open
    on main(ra, aa)
      alias ra : root folder
      list aa : items to be processed
    script o
    property destinationFolderName : "Renamed items"
    property numberFormat : "000" -- seq. number will be 001, 002, etc (if n > 999, use n as is)
    property nlen : count numberFormat
    property nmax : (10 ^ nlen - 1) as integer
    property xx : {}
    property astid : a reference to AppleScript's text item delimiters
    property astid0 : astid's contents
    property NL : return
    property errs1 : NL & NL & "This item will be left as is in: " & NL & NL
    property errs2 : NL & NL & "This item will be left as: " & NL & NL
    property btt1 : {"OK"}
    on decomp(s)
      string s : name string to decompose
      return list : {name stem, sequential number string, name extension}
      e.g. Given s : result
        "name1.001.jpg" : {"name1", "001", "jpg"}
        "name1.jpg" : {"name1", {}, "jpg"} -- [*]
        "name1" : {"name1", {}, {}}
        "name1..jpg" : {"name1", "", "jpg"} -- [*]
        "name1.name2.001.jpg" : {"name1.name2", "001", "jpg"}
        "name1.name2.jpg" : {"name1.name2", {}, "jpg"}
      [*] Note different meanings of {} and "" in result list
    local n, p, q, r
    try
    if s = "" then return {{}, {}, {}}
    set astid's contents to {"."}
    set s to s's text items
    tell s to set {n, r} to {reverse's rest's reverse, item -1}
    if n = {} then set {n, r} to {s, {}}
    tell n to set {p, q} to {reverse's rest's reverse, item -1}
    if p = {} then set {p, q} to {n, {}}
    try
    q as number
    set p to "" & p
    on error
    set {p, q} to {"" & (p & q), {}}
    end try
    set astid's contents to astid0
    on error errs number errn
    set astid's contents to astid0
    error "decomp():" & errs number errn
    end try
    return {p, q, r}
    end decomp
    on nextname(n)
      string n : source name
      property xx : names in pool
      property numberFormat, nlen, nmax: number format string, its length, max value respectively
      return string : new name with next sequential number
      e.g.
        Provided that n = "name1.jpg" and the name that has max seq. number
         with the same stem and extension as n in destination folder is "name1.005.jpg",
         resurt = "name1.006.jpg"
    local p, q, r, a, b, c, b1
    set {p, q, r} to decomp(n)
    if r = {} then set r to "_" -- give dummy extension if none (to handle it correctly)
    set b1 to 0
    repeat with x in my xx
    set x to x's contents
    if x starts with p then
    set {a, b, c} to decomp(x)
    if {a, c} = {p, r} then
    set b to 0 + b
    if b > b1 then set b1 to b
    end if
    end if
    end repeat
    set b1 to b1 + 1
    if b1 > nmax then
    return p & "." & b1 & "." & r
    else
    return p & "." & (numberFormat & b1)'s text -nlen thru -1 & "." & r
    end if
    end nextname
    try
    set da to (ra as Unicode text) & destinationFolderName & ":" as alias
    on error -- da not present
    tell application "Finder" to ¬
    set da to (make new folder at ra with properties {name:destinationFolderName}) as alias
    end try
    --set my xx to list folder da without invisibles -- this is faster but 'list folder' is deprecated in AS2.0.
    tell application "Finder" to set my xx to name of items of da as vector -- [1]
      [1] Finder (at least under OS9) returns [] (empty linked list) when returning empty list.
      This will cause error -10006 in 'set end of my xx to ...' statement, for linked list does not support it.
      The explicit 'as vector' will handle this case.
    repeat with a in aa
    set a to a's contents
    --set n to (info for a)'s name -- this is faster but 'info for' is deprecated under OSX10.5
    tell application "Finder" to set n to a's name
    if n = destinationFolderName then -- ignore it
    else
    set {n1, _step} to {nextname(n), 0}
    tell application "Finder"
    set sa to a's container as alias
    -- move or duplicate
    try
    if sa = ra then
    (* when run as Folder Action (or as droplet with items in ra) *)
    set a1 to (move a to da) as alias
    else
    (* when run as droplet with items outside ra *)
    set a1 to (duplicate a to da) as alias
    end if
    set _step to 1
    on error errs number errn
    (* name conflict, etc *)
    display dialog errs & " " & errn & errs1 & sa buttons btt1 ¬
    default button 1 with icon 2 giving up after 15
    end try
    -- rename
    try
    if _step = 1 then set {a1's name, _step} to {n1, 2}
    on error errs number errn
    (* name conflict, invalid name, etc; not probable but possible *)
    display dialog errs & " " & errn & errs2 & a1 buttons btt1 ¬
    default button 1 with icon 2 giving up after 15
    end try
    end tell
    if _step = 2 then set end of my xx to n1
    end if
    end repeat
    end script
    tell o to run
    end main
    --END OF SCRIPT
    Message was edited by: Hiroto (fixed typo)

Maybe you are looking for

  • I cannot search through messages after updating to IOS 6.1.2

    After updating to IOS 6.1.2 i cannot search for messages

  • How to populate value frm SO to Delivery List

    hi all i am getting the values in VA05 for the fields created by and order quantity,when i run vl10a i am nt able to find the same values here ,can u all check the same and give ur valuable suggestions so that i can fetch the values in Delivery List.

  • Daily Production Plan query changes

    Dear Experts, I was tried  to do a daily production plan query,  but i need to add one more feild in the below query, (ie) In sale order Document, Row level feild of Quantity ( RDR1,Quantity) should be in that query, SELECT T0.[ItemCode],T1.[ItemName

  • Linux: Table Data view - Filter cannot be edited

    When using SQL Developer 1.2.1.32.13 on Ubuntu (Gutsy), and entering a filter on the Data tab of a table, the filter cannot be edited anymore. The Delete and Backspace keys are non functional. I have selected the Default accelerators, but that does n

  • JDeveloper - MapViewer - Svg

    Hi, I'm using mapviewer and svg samples. But I can't work any svg with Embedded OC4J Server. When I work svgmap.jsp in my project, I get a empty map. But if I deploy this project to Standalone OC4J then svg is working. How can I solve this prolem? İs