If else statements

Hello world!

I cannot re written one "if else" statement of Excel in ActionScript 3. Maybe someone can tell me what am I translated badly in the new formula of AS3.

The original argument of Excel is:

=IF(AND(F8<=5,F39>=10),10,IF(AND(F8<=5,F39<10),F39,IF(AND(F8>=6,F8<=10,F39>30),30,IF(AND(F8>=6,F8<=10,F39<=30),F39,IF(AND(F8>10,F39<30),F39,30)))))

I translated this into AS3 as follows:

if(q1_preCalc <= 5 && q13_preCalc >= 10)
     {
          q13_preCalc = 10;
     }else if ( q1_preCalc <= 5 && q13_preCalc < 10)
     {
          q13_preCalc = q13_preCalc;
     }else if (q1_preCalc >= 6 && q1_preCalc <= 10 && q13_preCalc > 30)
     {
          q13_preCalc = 30;
     }else if (q1_preCalc >= 6 && q1_preCalc <= 10 && q13_preCalc <= 30)
     {
          q13_preCalc = q13_preCalc;
     }else if (q1_preCalc > 10 && q13_preCalc < 30)
     {
          q13_preCalc = 30;
     }else
     {
          q13_preCalc = 30;
     }

As you can see, I'm trying to set the vaule of the variable "q13_preCalc" according to the value of 2 other variable: q1_preCalc and q13_preCalc (himself).

After you set the value, I do the calculation with the value:

q13_preCalc_2 = (q13_preCalc*0.01)*-2.787;

I don't know if I translate the "If another 'instructions properly in AS3 since Excel."

Thank you in advance for your help!

Rafa.

It seems correct to me, just the last part is different:

IF (AND (F8 > 10, F39<>

but in AS3 you wrote:

If (q1_preCalc > 10 & q13_preCalc)<>
{
q13_preCalc = 30;

...

}

and I see in your AS3 to 2 variables: q1_preCalc, q13_preCalc

Where is the 3. ?

in Excel, you have 3 cells (values): F8, F39 and the cell containing the formula.

Tags: Adobe Animate

Similar Questions

  • If/else statement in the MathScript node

    I want to write if/else statement in MathScript node.

    If (Yes is Yes)

    {

    a = 0;

    }

    other (no = no)

    {

    b = 1;

    }

    'Yes' and 'No'--> of Type String

    'a' and 'b'--> Type Double

    Hi johndoe.

    Thank you for contacting National instruments.

    I would like to highlight a number of items which you may find useful for the implementation of an if-else statement in a MathScript node.  The first is a book white tutorial, which the second part explains how to use LabVIEW MathScript node. The second is an article describing the required syntax to write functions and scripts in the MathScript node, including instructions for the use of the If-Else statements.

    I hope that these help. Please let me know if you need additional assistance.

    Kind regards

    James

  • OATS: script entering does not in the if-else statements

    I created a functional test using Oracle's Web. My database file (.csv) contains a number of numbers that are used to browse through the script with different values. now in my loop for, I have included an if-else with action statements in these (Actions like) by clicking on the different tabs. Now, when I run my script, is to not enter the if-else statement and jumping directly to the next step.

    Here are my script:

    beginStep ("search page", 5)

    {page opening}

    String Var1 = (string) 'value from the .csv data bank ";

    for (int i = 1; i < = 2; i ++)

    {

    beginstep("/ASC",0)

    {

    if(var1=="ABC")

    {

    Task1;

    Task2;

    }

    ElseIf (Var1 == "efg")

    {

    Task1;

    Task2 ;}

    }

    }

    endStep();

    beginStep("/asc",0)

    {

    Task3;

    Task4;

    }

    endStep();

    }

    According to my above script, the script is to jump directly to TAsk3 and 4, instead of going to task if-else performing 1 and 2.

    Thanks in advance.

    Kind regards

    Deepak Khari

    Hello

    Use eval(), c.


    String Var1 = eval ("{{db. Var1.ColumnName}} ")." ToString();

    System.out.println ("scnro_class--->" + Var1);


    Kind regards

    Dembélé M

  • 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

  • hide and show the icon view using if else statement

    is - it possibleto hide and expose the display icon using if else statement? I try to use erase them but I don't know how show it on again after that I want to come back. Thank you

    There are two functions... EraseIcon and Exposeicon

    Mike

  • JavaScript custom for If/Then/Else statement code

    Can someone help me understand this code. I have a field in a PDF file that I need to generate a discount based on the price of an item. If the price is higher than 5000, then I need the field to say 1500. Otherwise the field discount must be price *. 30.

    I tried, but it did not work: if price > 5000 then discount = discount 1500 = price*.3

    Someone at - it help?

    Thank you!

    Acrobat forms use JavaScript, so you need to use the JavaScirpt syntax for JavaScript syntax appropriate for the 'If... else' statement. You will also need to access the domain object as established by the Acrobat JavaScript object using the method "getField" of the doc, "this.getField (cName)" object, then the property "value" for this object.

    custom calculation script for the ' discount field

    establish the name of the price field

    var c = "price";

    get the value of the price field

    var nPrice = this.getField (c) .vallue;

    Assume that the discount is 30% of the price

    NPrice = Event.Value * 0,30;

    the value of reduction 1 500 if the price is higher to 5,000

    If {(nPrice > 5000)

    Event.Value = 1500;

    }

    end of the custom calculation script

    For more information, see Conditional Execution by Thom Parker.

  • If and Else statements? Help!

    I am a dress up game in Adobe Flash 8 (AS2) and I am trying to Show and hide multiple video Clips on the release of a button to sort of a menu like this:


    http://charfade.deviantart.com/art/dress-up-NALA-game-107105062


    Its probably if/else statements, but I do not know how their code in ActionScript 2 , so it could very well help if you had a response

    You can use the movieclips _visible property to show (mc._visible = true) and hide (mc._visible = false) a movieclip mc.

  • If an else statement does not

    I'm sure have the conditions and statements typed in wrong. Here is the original code:

    Stop();

    var my_timedReveal:Number = setTimeout (my_delayedReveal, 15000: 1);

    function my_delayedReveal (arg1) {}
    gotoAndPlay ("reveal2");
    }

    cardA .mouse .addListener (mouseDown);
    cardB.Mouse.addListener (mouseDown);
    cardC.Mouse.addListener (mouseDown);

    cardA.onRelease = function() {}
    gotoAndPlay ("reveal1");
    }

    cardB.onRelease = function() {}
    gotoAndPlay ("reveal2");
    }

    cardC.onRelease = function() {}
    gotoAndPlay ("reveal3");
    }

    only now, I want to add an if/else statement so that if none of the mouseDown conditions are met, it will then the variable timeout:

    I have not tried or no this result:

    var my_timedReveal:Number = setTimeout (my_delayedReveal, 15000: 1);

    If (cardA .mouseDown = true) {}
    gotoAndStop ("reveal2")
    }

    else {}
    my_delayedReveal = true;
    }

    What Miss me? Am I even close?

    I have not tried to reason with your code, but when you compare things to equal you use is, not =

    If (cardA .mouseDown == true) {}

    And in the case of a boolean comparison, like that you can just use...

    If {(cardA .mouseDown)

    So see if what you're trying or could have tried to work when you use the comparison properly.

  • PHP if else statement

    If ($_SESSION ["FirstName"] == "") AND ($_SESSION ['name'] == ' ') {}

    AND is not correct... what would I use to have an if else statement that has more then a variable as the fi part?

    If ($_SESSION ["FirstName"] == "" & $_SESSION ['name'] == ' ') {}

  • IF and ELSE statements

    The man... I'm so close to figure this out and I didn't have to go back on the forum for this because I had a few topics here already when I started this project and to halfway through it and now towards the end of it, LOL! I hope that you all don't mind!

    in any case...

    Now I am trying to get users to fill out 4 boxes with the correct information, then press the ENTER key to go to the next section. Everything works perfectly with this part of my code, however, it is the part on whether they enter the wrong info that I be puzzled over.

    I tried the ELSE statements and various forms of listeners and IF statements, but I can't seem to make it work.

    When they enter the wrong info, in the entry boxes, I have to be taken to a different image. I had a script in there little worked, but instead of him awaiting until they entered all the information, it would just automatically go to the 'wrong' because technically, they received only a chance to enter the first letter of the first word.

    in any case, the code that I use now is attached. It works very well except the part of the erroneous info being entered. If a user has just this framework (where the code is located) and hits ENTER, thn, they are taken as part of 'Wrong', which is good, because technically they do not capture in 4 boxes. But. If they start typing in a box and then press ENTER, they need the same "Incorrect" framework because they have not all enter, but it is not that. Even if they conclude each info box and a letter is missing for example, which is wrong and should go to this 'Wrong' page, but is not.

    Any ideas?

    It is strange.so your code looks like this (and all the other stuff that was already there?):

    If (Key.isDown (Key.ENTER)) {}
    trace ("talk to the hand, because I'm no longer listening.");
    Key.removeListener (listener);
    trace ("the time it was the Enter key, then I should evaluate.");
    Evaluate();
    }

    It should work. I just tested it and it works for me. Well, it worked on the second try, the first time that I misspelled "listner", so be sure that you have spelled everything correctly!

    Unless you are sure that it is the function of battery called? How do you know? Y at - he got another code which could be initially move the playback cursor?

    BTW, if you use Actionscript, you shouldn't use scenes. There are strange things that occur with it and it is not worth!

  • How to create a simple so that the else statement

    I tried for hours to find out how a simple calculation to display text in a field that is based on what is selected in another drop-down list.  My first time doing so, I'm not sure what I'm doing wrong.  Here's what I have so far:

    get the value of the field doctor

    var doctor = this.getField("Physician").value;

    Display according to chosen doctor number

    if(Physician=1) event.value = 100;

    ElseIf (physician = "2") event.value = 200;

    ElseIf (physician = '3') event.value = 300;

    else event.value = 0;

    You have made the classic mistake of using the wrong operator in if statements. The operator if in JS is 'is' (or ' = '). '=' is the assignment operator.

    In addition, in the first statement, you compare the values of a number and later on a string. You must be more coherent.

    Then use this code:

    // get the value of the Physician field
    var Physician = this.getField("Physician").valueAsString;
    
    // Display Number depending on Physician selected
    if (Physician=="1") event.value = 100;
    else if (Physician == "2") event.value = 200;
    else if (Physician == "3") event.value = 300;
    else event.value = 0;
    

    See your code, however, I don't think that you need an if at all... This code should do the same thing:

    event.value = Number(this.getField("Physician").valueAsString) * 100;
    
  • If else statement


    Hi Experts,

    I had a question of smal on if - other - end if.

    We can write a select query in if - else codition? actually I'm trying to place a select query in if - condition otherwise its not allow me.

    If Yes can you please provide a code example.

    Thanks in advance

    You want to use IF... ELSEWHERE in the SQL statement? If yes then if... On the OTHER is not supported in SQL. You can use CASES or DECODE to achieve the same in SQL.

  • How if loop else statement

    Hello

    I want to make a sign of opening and closing, I got to the part where I do the MC visible or hide in some time but I can't loop the statement.

    Basically, I want to show that the image is open from 10:00 to 20:30 and the rest of the time show the close image.

    Here is the code

    var d: Date = new Date();

    If ((d.getHours () > = 10 & & d.getHours < 8 ()) |) ((d.getHours () == 8 & & d.getMinutes () < = 30)) {

    Open.Visible = true;

    Close.Visible = false;

    } else {}

    Open.Visible = false;

    Close.Visible = true;

    }

    trace (d)

    He just read the time and see the how the image should be, but it will not loop the statement of any new.

    Can someone help me thank you.

    I don't think that your conditional will give you what you want because 8 is less than 10, so if something is greater than 10, it cannot be less than 8.  The getHours for 20:00 value is 20, not 8.

    In this question concerning the closure goes, since it doesn't seem to be such a rush, you can get away with just using the Timer class to run the code, every minute or so rather than constantly check every millisecond.  So create a timer and have the event handler function to process your conditional code.

    var: timer = new Timer (60000);

    timer.addEventListener (TimerEvent.TIMER, checkTime);

    function checkTime(evt:TimerEvent):void {}

    your if/else code goes here

    }

    Timer.Start ();

  • If the Else statement in the Validation of the values of other fields

    Thanks in advance for your help.

    Here is the statement:

    $3,000 (maximum)

    OR my remaining balance $ (field remaining balance)

    $ (total field)

    The maximum that the user can contribute is $ 3,000. If they enter a number greater than $3,000 for the balance, the total amount for this declaration should be $3,000. If they enter a number less than $3,000 for other balance, the total for that statement should be the number entered for the balance.

    I think I'm actually making it harder than it needs to be. I would like that the total field to evaluate user input in the field balance; If this number is large than.3, 000, the total is 3,000; If this is not the case, the field total is equal to the value entered in the balance field.

    Thanks again for your help.

    Gilad D (try67) wrote:

    There are two problems with your code:

    1. in a computation script we should apply the new value using event.value, not not not using the getField method.

    2. you must convert the value to 'Balance' a number explicitly.

    So the code should:

    var b = number (this.getField("Remaining_Balance").value);

    If {(b > 3000)

    Event.Value = 3000;

    } else event.value = b;

    I see, thank you Gilad.

  • If else statement / cash

    Hey all, its little bit hecktik

    If 125,14 * 5 * third digit after decimal point = 5) then (run my query
    other (run my other query

    How to make

    What I've done
    SELECT SUBSTR (Ltrim (NET_AMOUNT, "0123456789"), 4) IN VSS_EMPMONTHLYSALARY;

    How to adjust in the IF-else or CASE statement?

    Published by: Navneet Singh on October 31, 2011 14:54

    the best way should be to use case when instead of IF stmnt stmt

Maybe you are looking for