Arrays or Variable

Hi,
I’m trying to get a pass rating from my database, this
information is not in the database but it’s calculated from
information in the database.
I have 1500 user enrolled in my training and each individual
is in pps_principals.name
What I want is the top 10 pass rating. My thoughts on with
would be-
1. Query pulling all the names from the database and saving
them as a variable/array?
2. Query using the variable/array to count each persons
passes and saving them as variables/arrays?
3. Query using the variable/array to count each persons fails
and saving them as variables/arrays?
4. Do the calculations for the pass rate then display the top
10
Will this work and how?
Here’s what I have for 1 user, which gives me a pass
rating.
<cfparam name="start" default="">
<!---which is defined from pervious page--->
<cfquery name="passedModules" datasource="db”>
SELECT DISTINCT dbo.PPS_SCOS.NAME,
pps_transcripts.date_created, score, max_score, status
FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON
dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID =
dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
AND dbo.PPS_TRANSCRIPTS.STATUS LIKE 'P'
AND dbo.PPS_SCOS.NAME LIKE 'MT%'
AND PPS_TRANSCRIPTS.TICKET not like 'l-%'
AND dbo.PPS_SCOS.NAME NOT IN (
SELECT DISTINCT dbo.PPS_SCOS.NAME FROM (dbo.PPS_SCOS JOIN
dbo.PPS_TRANSCRIPTS ON dbo.PPS_SCOS.SCO_ID =
dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID =
dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
AND dbo.PPS_TRANSCRIPTS.STATUS LIKE 'F'
AND dbo.PPS_SCOS.NAME LIKE 'MT%'
AND PPS_TRANSCRIPTS.TICKET not like 'l-%' )
ORDER BY pps_transcripts.date_created desc
</cfquery>
<cfquery name="failedModules" datasource="db">
SELECT dbo.PPS_SCOS.NAME, pps_transcripts.date_created,
score, max_score
FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON
dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID =
dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
AND dbo.PPS_TRANSCRIPTS.STATUS LIKE 'F'
AND dbo.PPS_SCOS.NAME LIKE 'MT%'
AND PPS_TRANSCRIPTS.TICKET not like 'l-%'
ORDER BY pps_transcripts.date_created desc
</cfquery>
<cfquery name="completedModules" datasource="db">
SELECT DISTINCT dbo.PPS_SCOS.NAME,
pps_transcripts.date_created
FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON
dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID =
dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
AND dbo.PPS_TRANSCRIPTS.STATUS LIKE 'C'
AND dbo.PPS_SCOS.NAME LIKE 'MT%'
AND PPS_TRANSCRIPTS.TICKET not like 'l-%'
ORDER BY pps_transcripts.date_created desc
</cfquery>
<cfquery name="completedModules" datasource="db">
SELECT SUM(SCORE) AS TOTSCORE
FROM (dbo.PPS_SCOS JOIN dbo.PPS_TRANSCRIPTS ON
dbo.PPS_SCOS.SCO_ID = dbo.PPS_TRANSCRIPTS.SCO_ID)
JOIN dbo.PPS_PRINCIPALS ON dbo.PPS_TRANSCRIPTS.PRINCIPAL_ID =
dbo.PPS_PRINCIPALS.PRINCIPAL_ID
WHERE dbo.PPS_PRINCIPALS.NAME LIKE '#start#'
AND dbo.PPS_SCOS.NAME LIKE 'MT%'
and PPS_TRANSCRIPTS.TICKET not like 'l-%'
and pps_transcripts.max_score > 0
and status like '[PF]'
</cfquery>
<cfset passes = passedmodules.recordcount>
<cfset fails = failedmodules.recordcount>
<cfset total = passes + fails>
<cfif total GT 0>
<cfset percentage = passes / total * 100>
<cfelse>
<cfset percentage="0">
</cfif>
<cfset pass = passedmodules.recordcount * 2>
<cfset fail = failedmodules.recordcount * 2>
<cfif total GT 0>
<cfset percent = passes / total>
<cfset total = pass - fail + percent>
<cfelse>
<cfset percent="0">
</cfif>

You are going to want to get all of that logic into a single
query if you want to pull the top 10 from 1500. Otherwise you are
going have to pull all of the records, make all of the
calculations, sort them, then display. Doing this in real-time on a
page loaded by an end user would be punishment, both for them and
for anyone else who may share your installation of CF.
Unfortunately trying to reverse engineer your database based
on these queries would take a little to much time and would likely
be prone to error. If you would like a solid response, I would
recommend creating a database diagram if you haven't already, take
a screen capture, then send us a link to the image.

Similar Messages

  • Assigning value to array type variable in a loop

    Hi
    I have a scenario in which i am assigning value from a array type variable(x) to the invoke variable of a database adapter. The variable x is exact replica of the invoke variable.
    My copy operation in assign activity looks like this-
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters"/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    </copy>
    It is inside a while loop activity.
    PS *()* are square brackets
    But it is erroring out at run time.
    Does anybody has an alternate idea to assign value to an array type?.
    i have seen that while extracting value from an array type variable it works fine
    A similar kind of operation is shown below.
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters"/>
    </copy>
    Thanks
    Ayush
    Edited by: Ayush fujitsu on Aug 14, 2009 4:36 AM

    Hi Ayush
    I suppose you are getting some error like "source node returns multiple elements".
    In second case there is no problem because you are assigning *InputParameters[bpws:getVariableData('iterator')]* (+suppose InputParameters[1]+) to target. Here it works fine because you are fetching oonly 1 value from source and assigning it to the target.
    Now in first case you are saying copy InputParameters to target[1] suppose. You know that source is an array which contains multiple index so which index field from the source will be assigned to the target.
    Try your process with only 1 source value it will work but when multiple values will be there it will fail. You have to merge both the cases and it will look like
    *<copy>*
    *<from variable="Var" part="InputParameters"*
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *<to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"*
    part="InputParameters"
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *</copy>*
    And the easiest way to do this is by the transform activity as said above.
    Regards
    Suryaveer
    Edited by: Suryaveer on Aug 15, 2009 11:19 PM

  • How to create a array with variables dimensions?

    I try to create a array like that:
    Object[][] data;
    data = new Object[] [];
    But that's doesn't work!
    Apparently I must specify the dimension of my array
    So I have done like that :
    Object[][] data;
    data = new Object[3] [3];
    And that work!
    But the problem is when I need to add extra elements to my array.
    If I write :
    data[4][1] = "123";
    I have the error message :
    java.lang.ArrayIndexOutOfBoundsException
    So, how can I defined a array with variables dimensions OR how can I add a dimension to a array?

    if you have:
    Object[][] data;
    data = new Object[3] [3];you end yo getting ArrayIndexOutOfBoundException if you try to point to some other Indexes. You can increase the size by doing new:
    Object[][] data;
    data = new Object[4] [3];and then copy the old Arrays to this one... this is heavy.
    Other thing to consider then is using some other datastructure, such as Vector, which grows along you add elements to it.
    P_trg

  • How to copy bytes to an array byte variable....??

    Hi everyone....can anyone help me out...i want to store byte into an array-byte variable,(byte by byte), which are returning from the readByte() function of DataInputStream.
    Thank you

    int filesize = request.getContentLength();
    byte dataBytes[] = new byte[filesize];
    int read=0;
    while( read <filesize)
    bytesRead[read++] =  in.readByte();  // *in* is object of DataInputStream
    }Change all that to this:
    int count;
    byte[] buffer = newbyte[8192];
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    while ((count = in.read(buffer)) > 0)
      baos.write(buffer, 0, count);
    byte[] data = baos.toByteArray();Of course, like your code, this assumes that the data will fit into memory. It is preferable to process the data read each time as you go rather than accumulating it all first and then processing. This saves both time and space.

  • Associative array two variable comparison :update table error

    Hi,
    i am using associative array to update the version number of table
    -i declare two associative array to compare the column from two table (temp,main tables)values in loop
    -if id's of both variable(for temp and main table) are equal and column of either of table not matching then it should update the version no of temp table
    -if id's not equal i.e record only exists temp table then update null version number annd increment it by 1
    -following is the structure and procedure --it shows the matching and non matching records but for the update statement it not giving expected output i.e it updates all records irrespective of the condition provided
    -i tried to put condition in update as well as in the  if statement but it updates all record
    ....suggestion and help highly appreciate. thankx in advance !!!
    /*--table structure and data--*/
    CREATE TABLE "TEMP_TABLE"
       ( "ID" NUMBER NOT NULL ENABLE,
      "COL1" VARCHAR2(20 BYTE),
      "COL2" VARCHAR2(20 BYTE),
      "VERSION" NUMBER
       INSERT INTO TEMP_TABLE VALUES (101,'A','B',NULL);
       INSERT INTO TEMP_TABLE VALUES (102,'x','y',NULL);
       INSERT INTO TEMP_TABLE VALUES (103,'r','t',NULL);
       CREATE TABLE "MAIN_TABLE"
       ( "ID" NUMBER NOT NULL ENABLE,
      "COL1" VARCHAR2(20 BYTE),
      "COL2" VARCHAR2(20 BYTE),
      "VERSION" NUMBER
       INSERT INTO MAIN_TABLE VALUES (101,'A','B',1);
    /*------update version procedure----------*/
    DECLARE
      TYPE T_tmp_table IS TABLE OF tmp_table %ROWTYPE INDEX BY PLS_INTEGER;
      TYPE T_main_table IS TABLE OF main_table%ROWTYPE INDEX BY PLS_INTEGER;
      l_tmp_table T_tmp_table;
      l_main_table T_main_table;
      BEGIN
        SELECT * BULK COLLECT INTO l_tmp_table FROM tmp_table;
        SELECT * BULK COLLECT INTO l_main_table FROM main_table;
        FOR i IN 1 .. l_tmp_table.count
        LOOP
          FOR j IN 1 .. l_main_table.count
         LOOP
      if(l_tmp_table(i).ID = l_main_table(j).ID AND l_tmp_table(i).VERSION IS NULL) then     
      ---this first if loop updates temp table version irrespective of l_tmp_table.ID=l_main_table.ID orl_tmp_table. ID<>l_main_table.ID  .it display proper matching and non-matching records.
       dbms_output.put_line('matching ids from tmp and main are :'||l_tmp_table(i).ID||'  '||l_main_table(j).ID);
       UPDATE tmp_table SET VERSION = l_tmp_table(i).version +1;
       --where l_tmp_table(i).ID = l_main_table(j).ID     --
       end if;
      if (l_tmp_table(i).ID <> l_main_table(j).ID) then
       dbms_output.put_line('non matching ids from tmp and main are :'||l_tmp_table(i).ID||'  '||l_main_table(j).ID);
       UPDATE tmp_table SET VERSION = l_tmp_table(i).version +1;
       --where l_tmp_table(i).ID <> l_main_table(j).ID    
        end if;
              END LOOP;
              END LOOP;
        EXCEPTION
        WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('OTHER');
    END;

    Hello user8937641
    I think there is a problem with the logic of your SQL-Code.
    But maybe in this formatted structure you can see where your problem is. -> I can not say it because I do not know what is the requirement.
    I hope it helps...
    /*------update version procedure----------*/
    DECLARE
      TYPE T_tmp_table IS TABLE OF tmp_table %ROWTYPE INDEX BY PLS_INTEGER;
      TYPE T_main_table IS TABLE OF main_table%ROWTYPE INDEX BY PLS_INTEGER;
      l_tmp_table T_tmp_table;
      l_main_table T_main_table;
      BEGIN
        SELECT * BULK COLLECT INTO l_tmp_table FROM tmp_table;
        SELECT * BULK COLLECT INTO l_main_table FROM main_table;
        FOR i IN 1 .. l_tmp_table.count
        LOOP
          FOR j IN 1 .. l_main_table.count
          LOOP
            IF     l_tmp_table(i).ID = l_main_table(j).ID
               AND l_tmp_table(i).VERSION IS NULL
             THEN
                 ---this first if loop updates temp table version irrespective of l_tmp_table.ID=l_main_table.ID orl_tmp_table. ID<>l_main_table.ID  .it display proper matching and non-matching records.
                 dbms_output.put_line('matching ids from tmp and main are :'||l_tmp_table(i).ID||'  '||l_main_table(j).ID);
                 UPDATE tmp_table
                    SET version = l_tmp_table(i).version +1;
                  WHERE id = l_tmp_table(i).ID
            END IF;
            IF l_tmp_table(i).ID <> l_main_table(j).ID
             THEN
               dbms_output.put_line('non matching ids from tmp and main are :'||l_tmp_table(i).ID||'  '||l_main_table(j).ID);
               -- Maybe you do not need this update:
               UPDATE tmp_table
                  SET version = l_tmp_table(i).version +1;
                WHERE id =  l_tmp_table(i).ID
            END IF;
            COMMIT;
           END LOOP;
        END LOOP;
      EXCEPTION WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('Error at Executing the PLSQL-Block - ' || SQLERRM);
    END;

  • How do I create an array with variables also splits words  in a txtfile?

    Hello guys,
    I made a script that reads a text file.
    function readMyFile()
    var myFile=File(app.activeDocument.filePath + "/LareLog.txt");
    if (myFile.exists)
            myFile.open("r");
            var Temps =  myFile.read();
            alert (Temps);                          // message the content
            var nyRad=("\n");                    // break the line
            textArr=Temps.split(nyRad);
            alert(textArr);                          // message the content with all info on new lines ("\n");
            myFile.close();
    my textfile contains:
    ~/Desktop/3.indd ,Thu Mar 20, 2014, 11:26:34 , GMT+0100
    I wonder how do I sort the content in array
    in this order, also creates variables for each string.
    var= string 1[~/Desktop/3.indd]
    var2=string 2[11:26:34]
    var3=string 3[11:26:34]
    var4=string 4[2014]
    var5=string 5 [GMT+0100]
    Thank you in advance people.

    Hmmh?
    Jump_Over said it before: „… are stored as separate array's elements …“ in your [textArr]
    So you can create now variables on this way:
    var string_1 = textArr[0]; // and so on
    alert(string_1);
    See Java Scripting reference for more examples how to use Arrays.

  • Can you pass an array URL variable

    Hi,
    Doing a form which I want to validate, then re-display with
    error messages and the keyed data still in place should there be
    errors, or go onto a second form if all ok.
    I have tried to use <form
    action="<?=$_SERVER['PHP_SELF']?>" but as the various
    outcomes result in different screens I can't see how to do it
    without having reams of duplicate code - I couldn't make it work
    satisfactorily anyway.
    So I decided to do it in two stages - form (user screen) + a
    separate validation routine which passes validation results back if
    there are errors by calling the first screen but with URL variables
    to trigger process variations or go onto screen 2 if all ok.
    But I'm struggling with this .. two questions:
    i) Ideally I would like to use a session variable to pass
    actual error messages back to screen one in the event of errors but
    if I undertand things correctly (which is by no means certain)
    $S_Session is already an associatve array so it wouldn't be so easy
    to just add a variable number of messages to it and then know what
    you are unpacking elsewhere ... do you know what I mean?
    Perhaps if I give you my second question it may help
    illustrate what I'm going on about in part 1
    ii) The way I have tried to do it is to set it up as an array
    ($ERRORS) in the validation module and then added a text string
    each time I hit a specific error. The hope was that I could then
    send this back via the URL for further process but I'm getting
    syntax problem so maybe this is not possible .... a brief example
    Input Form php:
    $ERRORS = array();
    $ERRORS = $_GET['errors']
    if (sizeof($ERRORS) > 0) {
    echo "<p class=\"val_err_hdr\"> *** Validation
    error(s) - please correct the entries and try again ***
    </p>";
    blah blah
    Validation php:
    $ERRORS=array();
    if(!$loginFoundUser) {
    $ERRORS[] = "This e-mail address entered has already been
    registered on our database - if you have already registered you
    can"; }
    header("Location: input.form.php?errors=$ERRORS");
    When I run this I get a syntax error 'unexpected T_IF' on the
    'sizeof'' function condition.
    Any help much appreciated.

    .oO(patricktr)
    > Doing a form which I want to validate, then re-display
    with error messages and
    >the keyed data still in place should there be errors, or
    go onto a second form
    >if all ok.
    OK, quite common.
    > I have tried to use <form
    action="<?=$_SERVER['PHP_SELF']?>"
    Avoid short open tags, they are unreliable. Use "<?php
    print " instead
    of just "<?=" to be safe and independent from the server
    configuration.
    >but as the
    >various outcomes result in different screens I can't see
    how to do it without
    >having reams of duplicate code - I couldn't make it work
    satisfactorily anyway.
    What's a "screen" in this case? Just another part of the form
    or a
    completely different page?
    > So I decided to do it in two stages - form (user screen)
    + a separate
    >validation routine which passes validation results back
    if there are errors by
    >calling the first screen but with URL variables to
    trigger process variations
    >or go onto screen 2 if all ok.
    Don't use URL parameters in such a form processing scenario.
    Use a
    session instead, that's what they are for. The length of URLs
    is limited
    and there are things you simply don't want to pass between
    pages, but
    keep on the server instead.
    > But I'm struggling with this .. two questions:
    >
    > i) Ideally I would like to use a session variable to
    pass actual error
    >messages back to screen one in the event of errors but if
    I undertand things
    >correctly (which is by no means certain) $S_Session is
    already an associatve
    >array so it wouldn't be so easy to just add a variable
    number of messages to it
    >and then know what you are unpacking elsewhere ... do you
    know what I mean?
    The $_SESSION array itself is strictly associative, the used
    indexes
    must be strings or the serialization of the session data will
    fail.
    But if course you can always do things like this:
    $_SESSION['errors'] = array();
    $_SESSION['errors'][] = 'something went wrong';
    > Perhaps if I give you my second question it may help
    illustrate what I'm going
    >on about in part 1
    > ii) The way I have tried to do it is to set it up as an
    array ($ERRORS) in the
    >validation module and then added a text string each time
    I hit a specific
    >error. The hope was that I could then send this back via
    the URL for further
    >process but I'm getting syntax problem so maybe this is
    not possible .... a
    >brief example ...
    As said above - use the session instead.
    > Input Form php:
    > $ERRORS = array();
    > $ERRORS = $_GET['errors']
    There's a ';' missing at the EOL (this causes the error you
    mentioned
    below).
    Just a naming hint: Variables should not be named all
    uppercase (except
    for the predefined superglobal arrays). Such names should be
    reserved
    for constants. The most common style looks like this:
    myNiceFunction()
    $myNiceVariable
    MY_NICE_CONSTANT
    > if (sizeof($ERRORS) > 0) {
    if (!empty($_SESSION['errors'])) {
    > header("Location: input.form.php?errors=$ERRORS");
    The Location URI must be absolute including scheme and
    hostname. This is
    required by the HTTP spec:
    header("Location:
    http://$_SERVER[HTTP_HOST
    But I'm still not sure why you would need this redirect. The
    entire
    handling of a form (validation, processing) can be done on a
    single
    page. Only if the processing succeeds, you might want to
    redirect to
    some result page.
    Micha

  • How to use an array for variable name of swing components using NetBeans

    I'm completely new to Java and GUIs, so excuse me if I use the wrong terminology. I'm making a JFrameFrom in NetBeans. I'm getting really tired of typing instructions like jTextField15.setText(variable[15].text); I would like to make the variable names of my text fields an array so I can use a loop to change the values, text, tooltips, etc. When I click "change variable name" it won't let me put an array in. The code that Swing generates is protected and I can't change it. I know there must be a way to do this. Any help is appreciated.

    Try not to use the NetBeans visual GUI builder. Then it should be easy to create an array of text fields:
    JTextField[] tfs = new JTextField[15];
    for (int i = 0; i < tfs.length; i++) {
        tfs[i] = new JTextField(10);
    }For laying out the text fields, see: [http://download.oracle.com/javase/tutorial/uiswing/layout/using.html]

  • Array of variables in reports

    Hello:
    I am beggining with reports 6i. I am doing a report and I need an array of number to hold ten different imports. I have a select with an import in every row, depending of the import (euro, usd, yen, etc) I need sum the import and finally to print the total import of euro, usd, yen, etc. I don't know how to define this variable.
    Thank you.

    Sorry for my english. Suppose I have the records:
    invoice import coin
    120 33.45 EUR
    121 98.34 EUR
    122 14.21 USD
    123 4.1 USD
    124 7.35 YEN
    I need this report:
    Invoice ... Import in Euros Import in coin
    120 ... 33.45 33.45 EUR
    121 ... 98.34 98.34 EUR
    122 ... 17.46 14.21 USD
    123 ... 5.04 4.1 USD
    124 ... 7.35 5.15 YEN
    131.79 EUR
    18.31 USD
    5.15 YEN
    Thank you.

  • Copying Arrays - Instance Variables - Multiple Animations

    Hi All!
    Thanks so much, in advance, as always, for your assistance!
    So, here's a site I'm working on:
    http://www.mediamackenzie.com/cmix/cmix10.html
    I have 3 quick questions:
    - I tried, when I first started making this site, to load all of the artwork images into an array and then copy the array before resizing them for their specific functions (being seen as thumbnails or as full size pics.) Unfortunately, I ran into the well known issue of Array cloning only creating a pointer to the same group of items. I tried the newArray = oldArray.slice() trick, but it didn't seem to work. Finally, I just loaded the images twice into two separate arrays, and it works, but I hate this solution. Anyone got a better one?
    - I'm trying to maintain some sort of connection between the two sets of Arrays so that, for example, when someone clicks on Thumbnail 15, Fullsize Image 15 will open up but I couldn't find anything that worked. Renaming the Instance Name dynamically didn't seem to work and adding an Instance Variable dynamically doesn't seem possible either as I can't make the Class I am working with (Sprite, in this case) dynamic ahead of time. I'm sure there's a simple method for this. Any suggestions?
    - Lastly, notice how when the site opens up, the different animations seem to interfere with each other and slow each other down (they also seem to get interference from the time taken to load the image Arrays.) Anyone got any high level suggestions for how to avoid this?
    Thanks So Much!
    and Be Well
    Graham

    I'm still stuck, but close, I think. The URL: http://www.mediamackenzie.com/cmix/cmix11.html
    Here is the code from frame 1 of my Gallery MovieClip (an instance of which is created dynamically in the main timeline):
    stop();
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    var idealH = 120;
    var idealW = idealH + 50;
    var loadH = 300;
    var loadW = loadH * 2;
    var thumb = 0;
    var loadNum = 0;
    var thumby:Sprite;
    var darkStage:Sprite;
    var loadSprite:Sprite;
    var thumbArray:Array = new Array();
    var loadArray:Array = new Array();
    var bigLoad:Loader;
    var reSized:Boolean = false;
    this[thumb] = new Loader();
    this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
    this[thumb].load(new URLRequest("images/0.png"));
    thumbArray.push(this[thumb]);
    function thumbComplete(e:Event):void {
        trace("thumbComplete");
        thumb++;
        this[thumb] = new Loader();
        this[thumb].load(new URLRequest("images/" + thumb + ".png"));
        thumbArray.push(this[thumb]);
        this[thumb].contentLoaderInfo.addEventListener(Event.COMPLETE, thumbComplete);
        this[thumb].contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, thumbError);
    function thumbError(e:IOErrorEvent):void {
        trace("thumbError");
        thumb = 0;
        thumbArray.pop();
        loadArray = thumbArray.slice();
        gotoAndStop(2);
    Now, here is the code from frame 2:
    //stop();
    addArrows();
    thumbResize();
    loadResize();
    function thumbResize():void {
    trace("thumbResize");
        for (var batch = 0; batch < Math.ceil(thumbArray.length / 8); batch++) {
            trace("batch " + batch);
            var batchSprite: Sprite = new Sprite();
            batchSprite.x = (batchSprite.x + (idealW / 1.5) + (batch * 800));
            //batchSprite.mouseEnabled = false;
            addChild(batchSprite);
            for (var row = 0; row < 2; row++) {
                trace("     row " + row);
                for (var col = 0; col < 4; col++) {
                    trace("          col " + col);
                    trace("               thumb " + thumb);
                    //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
                    if ( thumbArray[thumb].content.width > idealW || thumbArray[thumb].content.height > idealH) {
                        //And if the width of the image is greater than the height, apply Scaler 1...
                        if ( thumbArray[thumb].content.width > thumbArray[thumb].content.height ) {
                            //Scaler 1 is the ratio of the ideal width to the image width
                            var scaler1 = idealW / thumbArray[thumb].content.width;
                            trace("               scaler1 = " + scaler1);
                            //Apply Scaler 1 to both the width and height of the image
                            thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler1;
                            trace("               image width:" + thumbArray[thumb].content.width);
                            trace("               image height:" + thumbArray[thumb].content.height);
                            //Otherwise, apply Scaler 2
                        } else {
                            //Scaler 2 is the ratio of the ideal width to the image height
                            var scaler2 = idealW / thumbArray[thumb].content.height;
                            trace("               scaler2 = " + scaler2);
                            //Apply Scaler 2 to both the width and height of the image
                            thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler2;
                            trace("               image width:" + thumbArray[thumb].content.width);
                            trace("               image height:" + thumbArray[thumb].content.height);
                        //Otherwise... (that is, the image width and height are in both cases less than the ideal)
                    } else {
                        //And if the width of the image is greater than the heigh, apply Scaler 3
                        if ( thumbArray[thumb].content.width > thumbArray[thumb].content.height ) {
                            //Scaler 3 is the ratio of the ideal width to the image width
                            var scaler3 = idealW / thumbArray[thumb].content.width;
                            trace("               scaler3 = " + scaler3);
                            //Apply Scaler 3 to both the width and height of the image
                            thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler3;
                            trace("               image width:" + thumbArray[thumb].content.width);
                            trace("               image height:" + thumbArray[thumb].content.height);
                        } else {
                            //Scaler 4 is the ratio of the ideal width to the image height
                            var scaler4 = idealW / thumbArray[thumb].content.height;
                            trace("               scaler4 = " + scaler4);
                            //Apply Scaler 4 to both the width and height of the image
                            thumbArray[thumb].content.scaleX = thumbArray[thumb].content.scaleY = scaler4;
                            trace("               image width:" + thumbArray[thumb].content.width);
                            trace("               image height:" + thumbArray[thumb].content.height);
                    thumbArray[thumb].content.x = - (thumbArray[thumb].content.width / 2);
                    thumbArray[thumb].content.y = - (thumbArray[thumb].content.height / 2);
                    thumby = new Sprite();
                    thumby.addChild(thumbArray[thumb]);
                    thumby.y = (row * (idealW + (idealW / 8)));
                    thumby.x = (col * (idealW + (idealW / 8)));
                    thumby.buttonMode = true;
                    thumby.useHandCursor = true;
                    thumby.addEventListener(MouseEvent.CLICK, enLarge);
                    batchSprite.addChild(thumby);
                    thumb++;
    function loadResize():void {
        trace("loadResize");
        for (var ex = 0; ex < loadArray.length; ex++) {
            //If the width of the image is greater than the ideal width, OR the height is greater than the ideal height...
            if ( loadArray[loadNum].content.width > loadW || loadArray[loadNum].content.height > loadH) {
                //And if the width of the image is greater than the height, apply Scaler 1...
                if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                    //Scaler 1 is the ratio of the ideal width to the image width
                    var scaler1 = loadW / loadArray[loadNum].content.width;
                    //Apply Scaler 1 to both the width and height of the image
                    loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler1;
                    //Otherwise, apply Scaler 2
                } else {
                    //Scaler 2 is the ratio of the ideal width to the image height
                    var scaler2 = loadW / loadArray[loadNum].content.height;
                    //Apply Scaler 2 to both the width and height of the image
                    loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler2;
                //Otherwise... (that is, the image width and height are in both cases less than the ideal)
            } else {
                //And if the width of the image is greater than the heigh, apply Scaler 3
                if ( loadArray[loadNum].content.width > loadArray[loadNum].content.height ) {
                    //Scaler 3 is the ratio of the ideal width to the image width
                    var scaler3 = loadW / loadArray[loadNum].content.width;
                    //Apply Scaler 3 to both the width and height of the image
                    loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler3;
                } else {
                    //Scaler 4 is the ratio of the ideal width to the image height
                    var scaler4 = loadW / loadArray[loadNum].content.height;
                    //Apply Scaler 4 to both the width and height of the image
                    loadArray[loadNum].content.scaleX = loadArray[loadNum].content.scaleY = scaler4;
            loadArray[loadNum].content.x = - (loadArray[loadNum].content.width / 2);
            loadArray[loadNum].content.y = - (loadArray[loadNum].content.height / 2);
            loadNum++;
    function addArrows():void {
        trace("addArrows");
        var batches =  Math.ceil(thumbArray.length / 8);
        var m = 0;
        trace("batches = " + batches);
        if (batches > 1) {
            for (var k = 1; k < batches; k++) {
                var triW = 20;
                var startX = (((800 - triW) * k) + (triW * m));
                var startY = (idealW / 2);
                var tri:Sprite = new Sprite();
                tri.graphics.beginFill(0xFFFFFF);
                tri.graphics.moveTo(startX, startY);
                tri.graphics.lineTo(startX, (startY + triW));
                tri.graphics.lineTo((startX + triW), (startY + (triW/2)));
                tri.graphics.lineTo(startX, startY);
                tri.graphics.endFill();
                tri.buttonMode = true;
                tri.useHandCursor = true;
                tri.addEventListener(MouseEvent.CLICK, moveLeft);
                addChild(tri);
                var tri2:Sprite = new Sprite();
                var startX2 = (startX + (triW * 2));
                tri2.graphics.beginFill(0xFFFFFF);
                tri2.graphics.moveTo(startX2, startY);
                tri2.graphics.lineTo(startX2, (startY + triW));
                tri2.graphics.lineTo((startX2 - triW), (startY + (triW / 2)));
                tri2.graphics.lineTo(startX2, startY);
                tri2.graphics.endFill();
                tri2.buttonMode = true;
                tri2.useHandCursor = true;
                tri2.addEventListener(MouseEvent.CLICK, moveRight);
                addChild(tri2);
                m++;
    function moveLeft(event:MouseEvent):void {
        var leftTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x - 800), .5, true);
    function moveRight(event:MouseEvent):void {
        var rightTween:Tween = new Tween(this, "x", Regular.easeOut, this.x, (this.x + 800), .5, true);
    function enLarge(event:MouseEvent):void {
        darkStage = new Sprite();
        darkStage.graphics.beginFill(0x000000, .75);
        darkStage.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
        darkStage.addEventListener(MouseEvent.CLICK, reMove);
        darkStage.buttonMode = true;
        darkStage.useHandCursor = true;
        parent.addChild(darkStage);
        var nmbr = thumbArray.indexOf(event.currentTarget);
        bigLoad = new Loader();
        bigLoad = loadArray[nmbr];
        trace("bigLoad: " + bigLoad);
        loadSprite = new Sprite();
        loadSprite.addChild(bigLoad);
        loadSprite.x = (stage.stageWidth / 2);
        loadSprite.y = (stage.stageHeight / 2);
        loadSprite.addEventListener(MouseEvent.CLICK, reMove);
        loadSprite.buttonMode = true;
        loadSprite.useHandCursor = true;
        parent.addChild(loadSprite);
    function reMove(event:MouseEvent):void {
        parent.removeChild(darkStage);
        parent.removeChild(loadSprite);
    The function enLarge is the source of the issue (I want the enlarged image to show up and it's not.)
    Please help if you can!
    Thanks,
    Graham

  • 2D double array shared variable in real-time application

    Hi,
    I am using Labview 8 and I created a real-time application using shared variables. Is it possible to create a 2D array of double (I don't find how to do itdirectly). Probably I can define my own control and load this control as the custom data type of my variable. But is it recommended to do that?
    Thank you
    Alexandre Boyer

    Another way to do this is to specify your shared variable to be a custom control and create a control that simply has a 2-D array in it.  I've attached a zipped LabVIEW 8.2 project that shows both methods.  Enjoy!
    Becky
    Becky Linton
    Field Engineer - Michigan
    National Instruments
    Attachments:
    2DArraySharedVariable.zip ‏110 KB

  • Creating a array from variables passed from php

    I have passed variables from PHP to flash successfully but
    now need to firstly make them into an array. A next button and
    previous button has to trigger the step through the array.
    Any ideas?

    I have a PHP script and I get flash to load the variables
    from it. The code is as follows. Taken out the connection to DB for
    security.
    <?php
    $hostname_conn = "";
    $database_conn = "";
    $username_conn = "";
    $password_conn = "";
    // establish a SQL connection to the host - host, user, pass
    $conn = mysql_pconnect($hostname_conn, $username_conn,
    $password_conn) or trigger_error("The site database appears unable
    to provide a connection. Please contact support.
    ".mysql_error(),E_USER_ERROR); // or die("The site database appears
    unable to provide a SQL connection. Please contact support.");
    // connect to the right DB (there may be multiple db's on the
    server) dbName
    mysql_select_db($database_conn, $conn) or die("The site
    database appears to be unavailable. Please contact support.");
    $qCheck = "SELECT * FROM pics";
    $rsCheck = mysql_query($qCheck) or die("Check Failed :
    ".mysql_error());
    $cCheck = mysql_num_rows($rsCheck);?>
    &img=<?php
    while($row= mysql_fetch_assoc($rsCheck))
    print($row["img"]);
    ?>

  • Finding a value within an array or variable

    Hello,
    I just recently made the shift from ASP to JSP development and am having some trouble in finding a solution to my needs. I need to check the contents of an array particular value. The array contains the child content of its parent i.e. the chapters within a book. Does anyone have an idea as to how I can quickly check the array to see if it contains the value I am looking for or will I have to use a forEach loop and a boolean variable to accomplish this?

    There's no other way then a loop. An array in Java is basically a list of things. The only way to go thru the items in it is to loop thru them. Even some method you might call in ASP would only do the same thing, so you could write a method do to instead of duplicating loops all over.
    If you are talking about associative arrays, Javascript has them if you are using JS (client side only, of course) or you could use HashMaps or Hashtables in your Java code to store things as key/value pairs. Then you can just get the value by the key.

  • Can the Property Loader load arrays of variable size?

    I need to run a series of tests on the same UUT, changing only one parameter at a time (for example, a frequency response test). The hardware developers would like to be able to change the values of parameters of the test at will, without making changes to the sequence. That's easy - just change the value of the parameter in the Properties file. The hard part is changing the number of iterations of the test, by ONLY adding or deleting the number of parameters from the text file. In other words, all I know during sequence editing is the types of parameters, not the values or how many. I want the test to loop as many times as there are sets of parameters in the text file.
    I would like to do this by loading the paramet
    ers as an array. But the Property Loader wants me to specify each variable while I am editing the sequence, including each individual member of the array (e.g. "Locals.Array[0].Value"). I want to do somthing like "Locals.Array[*].Value", where "*" means "all elements".
    Am I forced to write external code to load each parameter, or does TS have a native way to do this? Even better, has anybody done this already, and will you explain how? Thanks

    Hi,
    there's a couple of options here, and I've included what I think is the simplest below (using TestStand 2.0.1).
    It's not exactly elegant though. What I've done is to put in a step that finds out the number of steps to load (based on an earlier decision - in this case a message popup step). I read a number from the limits file, and use this in the looping options of the property loader step that's loading the values into the array. I've done it with a fixed size array target here, big enough to take any incoming data. (Otherwise, knowing how many items you're going to load from the limits file, you could start with an empty array and re-size it prior to loading).
    I've cheated slightly by using the pre-expression on the property loader step to specify where th
    e data is coming from and where it's going to in the sequence on each iteration of the loop based on the Runstate.Loopindex.
    Another option is to go straight into the property loader step, and keep loading properties until the Step.Result.NumPropertiesRead = 0 (remember we're only doing this one at a time)
    Another idea would be to load in a value, and check it isn't a "flag" value (i.e. you'd never use say 999 in your array, so set the last element in your limits file to this, and drop out of the loop when this happens.
    Further still, you've got the source code for the property loader step, so you could re-write it to make a custom step that loads an array until it fails all on its own (no looping in TestStand).
    Hope this gets you going
    S.
    // it takes almost no time to rate an answer
    Attachments:
    DynamicPropertyLoader.seq ‏32 KB

  • Array of variable-length lists in Action Engine

    I'm starting work on a application that consists of multiple sub-panels which each present a specific subset of the hardware functionality.  The hardware appears to the host mostly as memory-mapped registers.  I'm considering implementing the hardware interface in an Action Engine (AE) so that LV will automatically arbitrate among the hardware access requests from the sub-panels and because it (seems to me) to make the data flow more clear than the current implementation that uses a veritable plethora of queues, notifiers, and rendezvous to send requests and results between the sub-panels and the hardware interface at the top-level.
    The challenge is this, though:  Certain hardware addresses need to be modeled in multiple sub-panels -- maybe data at a certain address changes the functionality of some other addresses, or maybe different bit-fields within an address are part of different functional groups.   
    So any of sub-panel can request a read or write to the hardware, but often several of them need to see the resulting data.
    In order to keep the design modular and expandable I don't want to hard-code anything in the hardware AE that is specific to the sub-panels.   Instead, I intend to have the sub-panels "register" with the hardware AE indicating for which addresses they need to receive updates when some hardware address is read or written to.  This means the AE will have to keep the "registration" data in an un-initialized shift-register (USR).  But I want the hardware accesses to run as fast as possible, so I would like to ask for some suggestions how to implement this as efficiently as possible (avoiding, for example, clusters of arrays...)
    I imagine the sub-panel registration info might consist of a user-defined event reference (created inside the sub-panel VI) and a list of hardware addresses that the sub-panel is modeling.   Then when the hardware AE gets a request to read or write at some address it will also generate events to broadcast the data to the sub-panels that have registered for that address.   This will probably include 20-25 subpanels registering for a collective total of about 700 hardware addresses.  
    I'm less concerned about memory than speed.
    So, a few possibilities come to mind for how to implement the registration data in the AE USR:
    A) Have one 2-D array where the array contains one row per hardware address (~320), and columns contain the event refs for all the sub-panels registered for that address.   The width of the array would depend on whichever address has the greatest number of sub-panels registered for it (maybe 4-5?), but that still means the array would be pretty large (about 6.5 kbytes if a reference is a 32-bit value?)
    On the other hand, indexing into this array to look up the sub-panel references for the current address would be relatively quick and easy since the hardware address is the row number.
    B) Have two arrays where the array size is the number of sub-panels:  One 1D array for the registered event refs and one 2-D array for the addresses.  But different sub-panels will have different quantity of addresses registered, so that means the "width" of the address array would be as big as the largest number of addresses registered by one sub-panel (maybe 20?).   This would use a total of only about 1.5 kbytes, but I would have to search through all 25 address arrays to see if the current address is registered.
    C) or, some other way that I have not though of.   
    Once the "registration" data is received from the sub-panels during program initialization it is never changed, only read.   So at first glance it would seem (A) would be the faster implementation.  But I don't know what, if any, performance hit there would be from having such a large array in a USR, which is why I'm asking here.
    Any thoughts or suggestions would be greatly appreciated.
    Thank you and Best Regards,
    -- J.

    JeffBuckles wrote:
    Any thoughts or suggestions would be greatly appreciated.
    Thank you and Best Regards,
    -- J.
    Quick thought (hardly!)...
    I have used a "Self-Addressed Stamped Envelope" architectrure for those type os apps.
    DAQ device has a queue it monitors for subscription requests (Think of a in-box for Marketing deparetment).
    When client is created it submits a request via the queue for the subscription request that included a ref to its update queue and a list of teh channels it wants to watch. The clients then wait for updates.
    The Marketing department pass the request for updates (in-box of marketing department) to the production department (I used an AE to pass the mailing list) who picks through the acquired data and passes updates as requested to all of teh subscribing clients.
    Just sharing ideas,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

Maybe you are looking for

  • Attachment Size Inaccurate in Mail

    Hi, I have a 7.6MB .sit file I'm trying to send via the mail app. But as soon as I attach it to the email, it says the size of the total email is 10.2MB, and won't let me send it due to the 10MB limit on file size. Even if the text of the email is em

  • Is there a way to format my calendar groups?

    I want to set up each event under my Birthday calendar group to remind me 5 days before every year.

  • Logging step results question

    I'm using the sequential process model which includes database logging. I've modified the database schema and I am using my own insert statement. I'm trying to use the step results logging feature. I have 2 questions\issues I need help on: First Issu

  • Regenrate SAP_ALL in SU21 transaction

    Hello, Needed some info about the 'Regenerate SAP_ALL' button in transaction su21. I created an authorization object in a development client. I then created a new role using PFCG transaction in a customization client to which i assigned the authoriza

  • Lineas Guias

    Hola tengo un problema, bueno despues de formatear mi pc y de instalar todos mis programas entre ellos el pagemaker tengo problemas con unas plantillas que ya tengo hechas, que pasa, que cuando imprimo mis plantillas las lineas guias aparecen esta ve