help with if else statement and math.random

Hi a little new to js and need to fill in a text field with the text selected randomly from a range when a button depending on what is put into another text field that is also randomly.

I really hope that makes sense but here is code that I got so far

var bg = this.getField("Background").valueAsString;

var pt_sage = new array();

pt_sage [0] = 'of the text based on background. "

pt_Sage [1] = 'of the text based on background. "

var i = Math.floor (2 * Math.random ())

var pt_hermit = new array();

pt_hermit [0] = "text".

pt_hermit [1] = "text more»

var v = Math.floor (2 * Math.random ())

If (bg == 'Wise') {}

this.getField("PersonalityTraits").value = pt_Sage [i];

} else (bg == 'Hermit') {}

this.getField("PersonalityTraits").value = pt_hermit [v];

}

I hope someone can help and thanks in advance

You must change this:

var pt_sage = new array();

To do this:

var pt_sage = new Array();

Better yet, change it to:

var pt_sage = ["a text based on the merits," "a text based on the"];

Tags: Acrobat

Similar Questions

  • need help with the Update statement

    Hello
    I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.

    THE QUESTION
    / * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
    */

    I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
    SELECT
    s.deactivation_date
    FROM
    (
    SELECT
    a.deactivation_date,
    count(m.mission_id) as nomissions
    FROM
    agents a
    INNER JOIN
    missions_agents m
    on
    a.agent_id=m.agent_id
    GROUP BY
    a.deactivation_date
    ) s
    WHERE
    s.nomissions>7 AND s.deactivation_date IS NOT NULL
    .. .and the code for the first date of deactivation for each year of activation agent
    select 
    a2.deactivation_date
    from
    agents a2
    where a2.deactivation_date= 
    (
    select min(a.deactivation_date)
    from 
    agents a
    where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY'))
    )
    ..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.

    Any help greatly appreciated... :))

    I began to wonder how things would :)

    user8695469 wrote:
    First of all why he chooses the date the earliest of all agents

    UPDATE  AGENTS_COPY AC /* (1) */
    SET     DEACTIVATION_DATE = (
    SELECT  MIN(AGS.DEACTIVATION_DATE)
    FROM    AGENTS_COPY  AGS
    ,       AGENTS_COPY AC /* (2) */
    WHERE   TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */
    )
    

    He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.

    (1): when you do a correlated update it is useful to the table alias that you did right here.

    (2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.

    and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    
    WHERE EXISTS
    (
    SELECT
    a.agent_id,
    count(m.mission_id)
    FROM
    agents a
    /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */
    INNER JOIN
    missions_agents m
    ON
    a.agent_id=m.agent_id
    GROUP BY
    a.agent_id,
    a.deactivation_date
    HAVING
    count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL
    )
    

    Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.

    I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.

    Thank you!

  • Math.Round () and Math.Random)

    Hello

    Do we have the equivalent methods in J2ME for Math.round () and Math.Random ()? I could not find in Java.util.Math or net.rim.device.api.Math

    Thank you.

    Reshma

    @ JavaMEUser, you can write your own class of math for your application, use the following code...

    public static int round(float f)  {     return (int)(f + 0.5F);   }public static long round(double d) {                return (long)(d + 0.5D);   }
    

    Thank you!

  • How to use an IF ELSE statement and the xdoxslt: get_variable together?

    First of all, I'm a big fan of this forum and I would like to thank the community for helping to make better the world BI Publisher.

    I'm trying to populate a table with a value of years of data with column = PRODUCT and row = month to DATE. Here's the catch, not every month will be given. Then here's where is my problem, I am not able to use an IF ELSE statement with an expression XDOXSLT:GET_VARIABLE so that if there is no given for this month the default value will be 0.

    Can someone help me find a solution to one of the attempts below or a method entirely new? Thank you!

    BP4 = numeric value of months with a DATE (more code to extract only the month DATE not included here)
    JAN1 = PRICE if there is data, 0 otherwise

    (1) I tried and it did not work:
    <? If: xdoxslt:get_variable($_XDOCTX,'BP4'), 01 xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE) then another end if xdoxslt:set_variable($_XDOCTX,_'JAN1',0)? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    (2) I tried and it did not work:
    <? xdoxslt:IfElse (xdoxslt:get_variable($_XDOCTX,'BP4') = '01', xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE), xdoxslt:set_variable($_XDOCTX,_'JAN1',0))? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    (3) I tried and it did not work:
    <? xdofx:If xdoxslt:get_variable($_XDOCTX,'BP4') = '01' xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE) then another end if xdoxslt:set_variable($_XDOCTX,_'JAN1',0)? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    example of XML data:
    < ROW >
    < name > Craig Hernandez < / NAME >
    < DATE > 2013 - 01-01 T 00: 00:00.000 + 08:00 < / DATE >
    < PRICE > 31 < / PRICE >
    BPD of < PRODUCT > < / PRODUCT >
    < / ROW >


    -TRD

    Published by: 990965 on February 28, 2013 08:27

    >
    (1) I tried and it did not work:


    (2) I tried and it did not work:


    (3) I tried and it did not work:


    >
    so

    
    
    

    works for me, it's

  • the code does not: Please help! (if else statement)

    Hello

    I'm new to the edge and I'm doing a simple animation to a chart where there are 2 buttons and clicking the buttons that it animates each line as a symbol using "play()".

    I want to add is a set of variables so that once you click on the buttons each 'greenclicked' and 'redclicked' variable is set to 1 (instead of 0). It then check out using an IF/ELSE to see if you have already clicked on the other button (value 1) and if so it plays the timeline of "revealing" symbol.

    I followed the JS error until the IF statement, and I think that its to do with the condition but my javascript knowledge is limited, so I'm not sure of the correct syntax.

    Here is the code I use:

    READY COMPOSITION

    sym.getComposition () .getStage () .setVariable ('greenclicked', "0");

    var i = sym.getComposition () .getStage () .getVariable ('greenclicked');

    Console.log ("greenclicked initialized at ="+ i);

    //

    sym.getComposition () .getStage () .setVariable ('redclicked', "0");

    var k = sym.getComposition () .getStage () .getVariable ('redclicked');

    Console.log ("redclicked initialized at ="+ k);

    WHEN YOU CLICK ON THE RED BUTTON

    sym.getSymbol("red_line").play ();

    //

    sym.getComposition () .getStage () .setVariable ('redclicked', 1);

    //

    var i = (sym.getComposition () .getStage () .getVariable ('greenclicked'));

    //

    If (greenclicked == 1) {}

    Console.log ("greenclicked =" + i + ""-triggered revealer ' ");

    sym.getSymbol("revealer").play ();

    } else {}

    Console.log ("red revealer button not triggered");

    };

    DURING THE CLICK ON GREEN BUTTON

    sym.getSymbol("green_line").play ();

    //

    sym.getComposition () .getStage () .setVariable ('greenclicked', 1);

    //

    var k = (sym.getComposition () .getStage () .getVariable ('redclicked'));

    //

    If (redclicked == 1) {}

    Console.log ("redclicked =" + k + ""-triggered revealer ' ");

    sym.getSymbol("revealer").play ();

    } else {}

    Console.log ("green revealer button not triggered");

    };

    ----------------------------------

    The error I get in the console is "[11:42:26.893] Javascript error in the handler! Type of event = element.

    Help with this appreciated

    Thank you

    Ash

    Hello

    You create 2 variables: i and k. So you can use both.

    WHEN YOU CLICK ON THE RED BUTTON

    var k = (sym.getComposition () .getStage () .getVariable ('redclicked'));

    If (k == 1) {...

    DURING THE CLICK ON GREEN BUTTON

    var i = (sym.getComposition () .getStage () .getVariable ('greenclicked'));

    If (I == 1) {...

    Now, console.log () works fine.

  • Help with the insert statement

    Hello

    I was wondering if someone could help write me a sql statement.

    Here is my table:
    CREATE TABLE "TEMP_INVOICE" 
       ("INVOICE" VARCHAR2(100 BYTE),
         "DATE_OF_DOCUMENT" DATE, 
         "DATE_OF_PAY_DAY" DATE, 
         "D" NUMBER, 
         "K" NUMBER
       );
    Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.02.2012','dd.mm.yyyy'),to_date('01.03.2012','dd.mm.yyyy'),5000,0);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.04.2012','dd.mm.yyyy'),'','',1000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.05.2012','dd.mm.yyyy'),'','',3000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.06.2012','dd.mm.yyyy'),'','',1000);
    
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.07.2012','dd.mm.yyyy'),to_date('01.09.2012','dd.mm.yyyy'),8000,0);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.10.2012','dd.mm.yyyy'),'','',5000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.11.2012','dd.mm.yyyy'),'','',2000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.12.2012','dd.mm.yyyy'),'','',1000);
    I want to do is make an insert allows you to table another call is MADE:
    CREATE TABLE "INVOICE" 
       ("INVOICE" VARCHAR2(100 BYTE),
        "DATE_OF_DOCUMENT" DATE, 
         "DATE_OF_PAY_DAY" DATE,
         "DATE_OF_PAYMENT_REC" DATE,
         "VALUE" NUMBER,
         "VALUE_DEDUCT" NUMBER,
        "DATE_FROM" DATE,     
         "DATE_TO" DATE
         );
    Statements in the INVOICE table should be like this:


    ........ The Bill... date_of_document... date_of_pay_day... date_of_payment_rec... value... value_deduct... Date_from... Date_to
    1......     1000...............1.1.2012.................1.3.2012................NULL............................ 5000... NULL... 1.3.2012...1.4.2012
    2......     1000...............1.4.2012.................NULL..................... 1.4.2012...1000... 4000... 2.4.2012... 1.5.2012
    3......     1000...............1.5.2012.................NULL..................... 1.5.2012...3000... 1000... 2.5.2012... 1.6.2012
    4......     1000...............1.6.2012.................NULL..................... 1.6.2012...1000


    Can someone help me with the sql statement that would insert data from table to table Bill temp_invoice as in the example?

    Thank you!

    PS

    I would try to explain.
    (1) the first statement that is to be inserted is original imply that at which is different DATE_OF_PAY_DAY to NULL.
    To this inserted negative of the original imply, we must add date_from that is exatly the same date_of_pay_day and date_to which is exactly the same as the date of the first payment. Payment which came first!
    (2) we have now in the second insert statement. It will be the first payment of lease with date_of_document and date_pf_payment_rec, which is the same as date_fo_document. Value field will be populated with the amount of payment received and value_deduct field will be the value of the original imply - value of the first payment. Date is date_of_document + 1 and date_to is the date of the next payment.
    (3) Insert us the next installment. Date_od_payment_rec is the same as date_of_document... value is the amount of the second payment and value_deduct's previous value_deduct which was of 4000 - value of this second payment. date_from date_of_payment_rec + 1 and date_to is the date of the next payment

    So we continue this same pattern until we reached the final payment when we finish insert with the statement:
    Date of the document (date of the last payment received) and even for date_of_payment_rec and field value with the amount of the payment receieved. The rest (value_deduct, date_from, date_to) is null.

    I really hope you understand what I'm trying to do here.

    If you have any other questions please.

    Published by: user13071990 on November 22, 2012 04:16

    Published by: user13071990 on November 22, 2012 04:16

    Hello

    user13071990 wrote:
    ... Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.

    Ok!
    Be sure to post the results you want new data.

    You probably need to add "PARTITION BY the Bill" to all analytical clauses in my solution:

    INSERT INTO invoice
    ( invoice, date_of_document, date_of_pay_day, date_of_payment_rec
    , value,   value_deduct,     date_from,           date_to
    )
    SELECT       invoice
    ,       date_of_document
    ,       date_of_pay_day
    ,       CASE
               WHEN  k > 0
               THEN  date_of_document
           END          AS date_of_payment_rec
    ,       NVL (d, k)     AS value
    ,       NVL2 ( date_of_pay_day
                , NULL
                , SUM (d) OVER ( PARTITION BY  invoice
                                          ORDER BY      date_of_document
                         )
                - SUM (k) OVER ( PARTITION BY  invoice
                                          ORDER BY      date_of_document
                         )
                )     AS value_deduct
    ,       NVL ( date_of_pay_day
               , date_of_document + 1
               )          AS date_from
    ,       LEAD (date_of_document) OVER ( PARTITION BY  invoice
                                            ORDER BY      date_of_document
                               )
                          AS date_to
    FROM       temp_invoice
    ;
    

    Because I'm not an English speaker nativ, that I just posted what it should look like after the insert is successful.

    OK, so you can't explain as you want, but you still need to explain.

    ... @Frank Kulash: you are very close, but still not quite what I'm looking for.

    Point out where my solution is the production of incorrect results, and explain (as you can) how to get good results in these places.

  • parameter constraint and math.random height

    I'm a newbie script. I'm doing a script that will...

    1. Take all the items I chose
    2. Scale them down (in height) randomly between 30% and 100% of their original height.

    Here's what I have so far...

    get all the objects currently selected in the document

    selectedObjects var = app.activeDocument.selection;

    reduction of their size by a random number between 0 and 70%

    for (var i = 0; i < selectedObjects.length; i ++) {}

    Gets the height of the current object

    var myHeights = .height selectedObjects [i];

    take the height of the current object and scale of a random percentage

    selectedObjects [i] .height = Math.floor ((Math.random () * myHeights) +. 3);

    }

    And this is what he does, which is excellent...

    ThisPartIsWorking.gif

    But there are two problems, in that I am running...

    [Problem] The height is get scaled compared to the document instead of by the object report. I would like to be able to rotate the object about an axis manually before running the script and still evolve each individual height compared to each object. So far, my script is scaling compared to the document x, y (I think).

    ThisPartIsNotWorking.gif

    I put the pivot point for each of the rectangles in the bottom center, but no dice. In the script, how can I say to use the anchor point of the object to the scaling instead of the document?

    [B problem] I cannot compel the math.random to my values. For example, notice here

    ThisPartIsNotReallyWorking.gif

    that one of the rectangles eventually teeny (less than 30% of the height of the original). How to set constraints on the math.random so that it is easy for me to adjust the settings? Right now I use math.floor but I'm obviously something wrong.

    Any idea?

    I did a quick search and found a function to get a random number.

    Resize allows you to change the height rather than change the height property, which will take care of the problem B.

    //get all the objects that are currently selected in the document
    
    var selectedObjects = app.activeDocument.selection;
    
    //decrease their size by a random number between 0% and 70%
    
    for (var i=0; i
    

    for [A] problem, I would use a different approach. I would start with 1 item (since they are all the same) and duplicate, resize it and turn it as many times as I need to close the loop. We can use a fixed point by using these methods.

  • Help with a SQL statement...

    Hello...

    I have tried to find a way to write a SQL statement and may not seem to produce something that works. What I need is a set of results that returns each month that a given task is in an open State. The only columns that I have in my work table with are TASK_NM, OPEN_DT and CLOSED_DT.

    So if I have a line containing the following: TASK_NM = 'task one', OPEN_DT = April 18, 10 ' and CLOSED_DT = 14 October 10 '... I would like to see as a result set that looks like:

    TASK_NM YEAR JAN FEB MAR APR MAY JUNE JULY AUG SEP OCT NOV DEC
    the task of a 2010 0 0 0 1 1 1 1 1 1 1 0 0

    Is it still possible?

    Thanks in advance,
    David.

    Published by: user13027968 on March 10, 2011 14:19

    Published by: user13027968 on March 10, 2011 15:13

    Hello

    Welcome to the Forum!

    Whenever you have a question. Please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.
    For example, the sample data may be:

    CREATE TABLE     table_x
    (       task_nm          VARCHAR2 (10)
    ,     open_dt          DATE
    ,     closed_dt     DATE
    );
    
    INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('task a', DATE '2010-04-18', DATE '2010-10-14');
    INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo',    DATE '2010-10-31', DATE '2011-01-01');
    INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo',    DATE '2010-12-01', DATE '2011-02-21');
    INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('foo',    DATE '2011-04-01', DATE '2011-04-30');
    INSERT INTO table_x (task_nm, open_dt, closed_dt) VALUES ('bar',    DATE '2010-01-01', DATE '2010-01-01');
    

    From this data, you may want these results:

    TASK_NM     YEAR JAN FEB MAR APR MAY JUN JUL AUG SEP OVT NOV DEC
    ---------- ----- --- --- --- --- --- --- --- --- --- --- --- ---
    bar         2010   1   0   0   0   0   0   0   0   0   0   0   0
    foo         2010   0   0   0   0   0   0   0   0   0   1   1   1
    foo         2011   1   1   0   1   0   0   0   0   0   0   0   0
    task a      2010   0   0   0   1   1   1   1   1   1   1   0   0
    

    I'm not sure eactly how you plan to use it. Are there lines that overlap for the name of the task? You always want the same number of columns? What version of Oracle are you using?
    I think you want something like this:

    WITH     got_month_cnt          AS
    (
         SELECT  task_nm
         ,     TRUNC (open_dt, 'MONTH')     AS first_month
         ,     1 + MONTHS_BETWEEN ( TRUNC (closed_dt, 'MONTH')
                             , TRUNC (open_dt,   'MONTH')
                           )          AS month_cnt
         FROM    table_x
    --     WHERE     ...     -- If you want any filtering, put it here
    )
    ,     cntr     AS
    (
         SELECT     LEVEL     AS n
         FROM     (
                   SELECT  MAX (month_cnt)     AS max_month_cnt
                   FROM     got_month_cnt
              )
         CONNECT BY     LEVEL     <= max_month_cnt
    )
    ,     all_months     AS
    (
         SELECT     m.task_nm
         ,     ADD_MONTHS ( m.first_month
                      , c.n - 1
                      )          AS open_month
         FROM     got_month_cnt     m
         JOIN     cntr          c  ON     c.n     <= m.month_cnt
    )
    SELECT       task_nm
    ,       EXTRACT (YEAR FROM open_month)                         AS year
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jan' THEN 1 ELSE 0 END)     AS jan
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Feb' THEN 1 ELSE 0 END)     AS feb
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Mar' THEN 1 ELSE 0 END)     AS mar
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Apr' THEN 1 ELSE 0 END)     AS apr
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'May' THEN 1 ELSE 0 END)     AS may
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jun' THEN 1 ELSE 0 END)     AS jun
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Jul' THEN 1 ELSE 0 END)     AS jul
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Aug' THEN 1 ELSE 0 END)     AS aug
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Sep' THEN 1 ELSE 0 END)     AS sep
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Oct' THEN 1 ELSE 0 END)     AS ovt
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Nov' THEN 1 ELSE 0 END)     AS nov
    ,       MAX (CASE WHEN TO_CHAR (open_month, 'Mon') = 'Dec' THEN 1 ELSE 0 END)     AS dec
    FROM       all_months
    GROUP BY  task_nm
    ,       EXTRACT (YEAR FROM open_month)
    ORDER BY  task_nm
    ,            year
    ;
    

    This will work in Orfacle 9 (and), but from Oracle 11, you could simplify it a little bit by using SELECT... Function PIVOT.

    Published by: Frank Kulash, March 10, 2011 16:51

  • Help with if/else in the display of the data - (possibly foreach)

    Hi all

    I tried to put something in place, and I'm having difficulty to operate.

    84-111 lines became my biggest challenge.  I have an if/else statement implemented so that if a record has a picture on the local host that the image is pulled up.  The way I have it now, it works fine.

    If I swap lines 93-96 with 102-105 and a 90 just tweek line, I can get it to work if the image is on an alias and not localhost.

    The problem is that if I pretend it's now, I can't both work at the same time.  So I try to get the if/else statement to apply to each record that is pulled to the top.  It seems that what he does now is to choose what part of the if/else statement it should use for the first record and then that applies for all records.

    Is it possible to have coded it as if it was now for the if/else statement (because I want to be able to add multiple alias and just check to see if the image is on the localhost or not); but the image doesn't matter if the image is located on the local host or alias?

    Here's what I have so far:

    <?php
    $search = $_GET['series'];
    $query_begin=" SELECT * FROM movies WHERE movie_name_series = '$search' ";
    $search_begin = mysql_query($query_begin) or die(mysql_error());
    $row_begin = mysql_fetch_assoc($search_begin);
    if($row_begin == 0){
    ?>
    <script type="text/javascript"><!--
    setTimeout('Redirect()',0000);
    function Redirect()
    {
      location.href = 'index.php?content=noresult';
    }
    // --></script>
    <?php
     } 
    else 
    { 
                    $query_display = "SELECT * from series WHERE series_id = '$search'";
           $result_display = mysql_query($query_display);
           $row_display = mysql_fetch_array($result_display, MYSQL_ASSOC);
           
              $series_id = $row_diaplay['series_id'];
              $series_name = $row_display['series_name'];
        
        ?>
    <h2>All Movies in our Library categorized in the series <?php echo $series_name ?></h2>
    <br />
    <div style="float: left; width: auto">
        Click on the name of the movie to edit the movie.
    </div>
         <br />
            <hr size="1" noshade="noshade" />
      <br />
    <?php 
    $query="SELECT * FROM movies
      INNER JOIN family_rating ON movies.movie_star_rating=family_rating.star_id 
      INNER JOIN alias ON movies.alias=alias.alias_id
      INNER JOIN parent_alert ON movies.parent_alert=parent_alert.alert_id
      INNER JOIN rating ON movies.movie_rating=rating.rating_id
      WHERE movies.movie_name_series='$search'
      ORDER BY movies.movie_name ASC";
    $result= mysql_query($query)or die (mysql_error());
    while($row=mysql_fetch_array($result)){
    // Display the data 
    ?>
        <table width="200" style="margin: 20px">
        <tr align="center">
      <td valign="top">
       <h1 style="font-size: 12px"><?php echo $row['movie_name']; ?></h1>
            </td>
        </tr>
        <tr align="center">
      <td valign="top" style="width: 100%; border-bottom: ridge #FFF; border-left: ridge #FFF; background: url(assets/images/transback.png) repeat; padding: 10px">
       <a class="ToolText" onMouseOver="javascript:this.className='ToolTextHover'" onMouseOut="javascript:this.className='ToolText'">
       <style media="screen" type="text/css">
              
              #coverart {
                display: block;
                width: 110px;
                height: 150px;
              }
              #coverart:hover { 
                background: url("assets/icons/play_movie.png") no-repeat 0 0;
              background-size: 110px;
              }
             </style>
             
            <p>
             <form action="index.php?content=play_movie" method="post">
                <input type="hidden" value="<?php echo $row['movie_id']; ?>" name="movie" />
             <input type="hidden" value="<?php echo $row['warning'] ?>" name="warning" />
                
                                        <?php 
              if ($row['alias_name']='localhost') {
             ?>
                                        
                                        <input onmouseover='this.src="assets/icons/play_movie.png"' 
                                         onmouseout='this.src="movies/coverart/<?php echo $row['art']; ?>"'
                                        type="image" src="movies/coverart/<?php echo $row['art']; ?>" 
                                        style="border: none" height="150" width="110" />
                                        <?php
              }else{
               ?>
                                        
                                        <input onmouseover='this.src="assets/icons/play_movie.png"' 
                                         onmouseout='this.src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>"'
             type="image" src="http://<?php echo $row['ip_address']; ?>/<?php echo $row['alias_name']; ?>/coverart/<?php echo $row['art']; ?>" 
                                        style="border: none" height="150" width="110" />
                                        
                                        <?php
              }
              ?>
                                       
                </form>
                                        </p>
                     
                                    <span><h2 align="center"><?php echo $row['movie_name']; ?></h2>
            <?php echo $row['rating_name']; ?>
                                    <h4><?php echo $row['description']; ?></h4>
                                    
            
            <?php
             if($row['parent_alert']='1') {
              ?>
            <p align"center"><img src="assets/icons/<?php echo $row['alert_file_name']; ?>"></p></span>
                                    <?php
             } else {
             }
             ?>
                </a>
                <img src="assets/icons/s_<?php echo $row['star_file_name']; ?>" />
            </td>
     </tr>
        </table>
    <?
    }
    }
    ?>
    

    I looked through a number of tutorials and it is appropriate to use a loop for each.  However, I can't get this to work.  Is there anything I can do to make it work the way I'm trying to?  There is a problem with my if/else or do I need one for each?  If I need one for each, how can I do this?

    Thank you.

    9thReg wrote:

    I have a page that pulls in some records in a database, where I've got year if / else statement in the section where it shows the data.

                                        
    
    

    Thank you. It is much clearer, and he made the mistake of stand out immediately. You'll kick yourself when you realize what it is.

    Your condition in the condition clause is assigning the value "localhost" in $row ['alias_name'] instead of comparing the two values. You must use two equal signs to:

    
    

    I haven't checked the rest of your code, but the condition of fixing should solve the main problem.

  • Help with code to insert, and then update the form table.

    I have a form where a user can add a new record in a table. Here is the procedure for recording button that works very well. But I call another procedure for updating the table with an "if" statement "The SQL code that I use works fine to get the data I'm looking for when I run it in SQL, but the 'if' statement updates all records in the table to ' n ' when some should be"Y". I am new to Oracle forms development (3 months) so it's probably very simple, but I'm stuck and need to get this finished form. Any help is greatly appreciated.


    SAVE BUTTON TRIGGER PROCEDURE:*.

    PROCEDURE SAVE_MM_1099_ADD IS

    MM1099_NO NUMBER (10);
    NUMBER OF THE YEAR (4);
    NUMBER OF NOTICE_SEQ_NO (10);
    NOTICE_NAME VARCHAR2 (30);
    TIN_FROM_DB VARCHAR2 (23);
    TSDI_DB VARCHAR2 (1);
    IRS_NTYPE VARCHAR2 (10);
    IRS_NDATE VARCHAR2 (10);
    BU_WH VARCHAR2 (1);
    NO_TIN_NAME VARCHAR2 (1);
    DUP_IRS_NOTICE VARCHAR2 (1);
    G1_IRS_NOTICE_3YR_2BS VARCHAR2 (1);

    B_SAVE_ADD boolean;

    Start

    IF MM1099_NO IS NOT NULL THEN

    insert into MM_1099
    (
    MM1099_NO,
    YEAR,
    NOTICE_SEQ_NO,
    NOTICE_NAME,
    TIN_FROM_DB,
    TSDI_DB,
    IRS_NTYPE,
    IRS_NDATE,
    BU_WH,
    NO_TIN_NAME,
    DUP_IRS_NOTICE,
    G1_IRS_NOTICE_3YR_2BS
    )
    values
    (
    MM1099_NO,
    YEAR,
    NOTICE_SEQ_NO,
    NOTICE_NAME,
    TIN_FROM_DB,
    TSDI_DB,
    IRS_NTYPE,
    IRS_NDATE,
    BU_WH,
    NO_TIN_NAME,
    DUP_IRS_NOTICE,
    G1_IRS_NOTICE_3YR_2BS
    );


    : system.message_level: = '5';
    Commit_FORM;
    : system.message_level: = '0';

    END IF;

    UPDATE_NUMOCCURTIN;

    END;

    PROCEDURE CALLED:*.

    PROCEDURE UPDATE_NUMOCCURTIN IS

    CURSOR c1 (NUMBER NUMOCCURTIN) IS
    SELECT THE YEAR, TIN_FROM_DB, COUNT (TIN_FROM_DB) AS NUMOCCURTIN
    OF MM_1099
    TIN_FROM_DB GROUP, YEAR
    SEEN (COUNT (TIN_FROM_DB) > 0);

    CR1 c1% ROWTYPE;
    number of v_recs;
    NUMBER OF NUMOCCURTIN;

    BEGIN
    v_recs: = 0;

    OPEN c1 (NUMOCCURTIN);

    loop

    Fetch c1 into cr1;
    When the % notfound c1 or c1% rowcount output > v_recs;

    IF cr1. NUMOCCURTIN > 1 THEN

    UPDATE MM_1099
    SET DUP_IRS_NOTICE = 'Y ';

    ON THE OTHER

    UPDATE MM_1099
    SET DUP_IRS_NOTICE = 'N';

    : system.message_level: = '5';
    commit;
    : system.message_level: = '0';

    END IF;

    v_recs: = v_recs + 1;

    END LOOP;

    CLOSE c1;

    END;

    For any help or suggestion will be greatly appreciated.

    IF cr1. NUMOCCURTIN > 1 THEN

    UPDATE MM_1099
    SET DUP_IRS_NOTICE = 'Y ';

    ON THE OTHER

    UPDATE MM_1099
    SET DUP_IRS_NOTICE = 'N';

    : system.message_level: = '5';
    commit;
    : system.message_level: = '0';

    END IF;

    There is no WHERE condition in your update, so always update you all THE RECORDS in your table. I guess it must be something like:

    UPDATE MM_1099 SET
      DUP_IRS_NOTICE = 'Y';
     WHERE TIN_FROM_DB=cr1.TIN_FROM_DB
       AND YEAR=cr1.YEAR
    

    Some general order questions about your code:
    Where your variables for your insert statement are filled? looking at your code they will always be NULL.
    Be careful when using the variable exactly as the names of column names. This may cause unexpected behavior (for example when it is used in the UPDATE statements).
    Why engage in the other branch, but not in the branch so?

  • Need help with Exchange 2010 Diag and implementation

    I NEED HELP FOR EXCHANGE 2010 DAG AND THE IMPLEMENTATION THAT CAN HELP-IM I IN THE RIGHT SUPPORT GROUP?

    Hello HectorLopez_790,

    Microsoft Communities is for consumer issues with Windows 8, Windows 7, Windows Vista and Windows XP. Your question with Exchange would be better supported in the TechNet forums.
    Click here for a link to transfer your question in the forums of Exchange.

    Thank you

    Marilyn

  • Help with shortcuts removed/dead and weird Windows Update

    OK, so some time so that I was on vacation, my om used my PC in about 5 min to do something I told him to do. And somehave, when I returned, all the buttons in the start menu under the 'Connect to' or wathever is blocked. Whenever I press them, Windows is opening an empty window. Like all empty them, no text at all. And shortcuts (those in the lower-right corner) died too, all of them.  In addition to the Windows Update, its quite weird. When I open and select 'Install updates' (because I turned off auto update), he did his thing and goes to the classic blue/green start with updated text. And stays there. Can use hours and get back, and it is screwed up and before it resets the fact again. And once again. And once again. Help!

    Kraizer,
    We need to know some info on your system.  What version of level pack Windows\service are you running?  What error codes do you receive?  Questions you have indicated, I would look for in an infection possible virus\malware.  You should take a look at this thread: Mike to get rid of malware – Microsoft answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • And anyone who has used the creative cloud cleaner to help with installation problems?, and anyone who has used the creative cloud cleaner to help with installation problems?

    And anyone who has used the creative cloud cleaner to help with installation problems?  I should try?

    Hi Alison,.

    You do not specify the issue that you are facing, but you can restore Photoshop CC 2014.Please use the link below to find out how to install an older version of any Application Adobe CC.

    How to find and install a previous Version of Adobe Apps in CC 2015 | Adobe Customer Care Team

    Link to adobe vacuum as you said use the Adobe Creative Cloud cleaning tool to solve installation problems

    Cloud troubleshooting creative risks troubleshoot Adobe Creative Cloud download and installation issues

    Let us know if that helps you solve/Rolling back Photoshop.

    ~ Assani

  • need help with the Merge statement

    I'm on: Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    I'm currently an UPDATE statement and then it works and is accurate, it takes 30 minutes. I heard that MERGE
    can do the same thing and is just as accurate and much faster!

    Here's the query I want to convert into a MERGE INTO statement. I tried to do it myself, but I get errors and don't know simply, since it's new for me.

    Basically I want to update table your on a corresponding condition in the table tt for 2 columns (GTP and UPDATE_DT), for UPDATE_DT I want to insert the Date current system.
    UPDATE /*+ PARALLEL (16) */  OLDER_Table ta
    
    SET (ta.GTP, ta.UPDATE_DT) = 
    
                    (SELECT /*+ PARALLEL (16) */ tt.GTP, SYSDATE
                     FROM NEWER_Table tt
                     WHERE ta.cust_id = tt.cust_id
                     AND ta.STAMP_DATE = tt.STAMP_DATE
                     AND ROWNUM = 1)
    
                     WHERE EXISTS (SELECT 1
                                   FROM NEWER_Table tt
                                   WHERE ta.cust_id = tt.cust_id
                                   AND ta.STAMP_DATE = tt.STAMP_DATE
                                   AND (NVL(ta.GTP, 'X') != NVL(tt.GTP, 'X'))); 
    Thank you!

    Hello

    Whenever you have a problem, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) of all of the tables involved.
    Also post the results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
    If you ask on a DML statement, such as UPDATE, CREATE TABLE and INSERT statements need to re - create the tables as they are before the DML, and results will be the content of the or the tables changed when it's all over.
    See the FAQ forum {message identifier: = 9360002}

    MERGE peut be much faster than update; Sometimes, there is no significant difference in speed.
    Tables in multiple situations like this, I've never seen a case where the MERGER has been slower than the UPDATE, even if the UPDATE is sometimes easier to code and just as fast.

    Maybe that's what you want:

    MERGE INTO  older_table            dst
    USING  (
               SELECT  n.cust_id
            ,        n.stamp_date
            ,        n.gtp
            ,        ROW_NUMBER () OVER ( PARTITION BY  n.cust_id
                                               ,           n.stamp_date
                             ORDER BY      n.gtp
                              )                    AS r_num
            FROM        newer_table  n
            JOIN        older_table     o  ON   n.cust_id     = o.cust_id
                                 AND     n.stamp_date     = o.stamp_date
                           AND     NVL ( n.gtp
                                    , 'X'
                                 )          != NVL ( o.gtp
                                                  , 'X'
                                              )
    
           )                 src
    ON     (    src.cust_id            = dst.cust_id
           AND  src.stamp_date     = dst.stamp_date
           AND  src.r_num            = 1
           )
    WHEN MATCHED THEN UPDATE
    SET    dst.gtp          = src.gtp
    ,      dst.update_date     = SYSDATE
    ;
    

    As I can't test it, I can't be sure.

  • Need help with a conditional statement

    OK, I have essentially a text box that gives descriptions when you hover over each button. I do not know how to encode, so far, that's what I have and when I mouse over the 'home' button I see var homeText in the text box, but when I'm not wriggle on I do not see the "else" statement that matches the text empty var.

    My question is how to do the "else" statement to work?

    Description of section text box.
    var empty: String = "INFO SPACE, point to things for a brief description.";
    var homeText:String = "return to the home page.";

    The 'Home' button action.

    var overHomeDes:Boolean = true;

    homeBorder_mc.addEventListener (MouseEvent.MOUSE_OVER, homeDes);
    function homeDes(event:MouseEvent):void

    {
    If (overHomeDes)

    {

    Description.Text = homeText;
    }

    on the other

    {

    Description.Text = empty;

    }
    }

    You will need to create a ROLL_OUT listener for the home button to get him back.  The mouse above machine occue when you hover over the button, it will appear only if, not the other, thw unless boolean is false.

    You won't need this conditional in there, unless that boolean is in another goal.

Maybe you are looking for