Getting variables out of a function

Hi,
In order to reduce the use of the calculation event in a repeating subform, I have set up a function (riskRating) in a script object (calculateRisk), which the exit event of a dropdown (RA_severity) calls.
//This is the Javascript in the exit event...
var vLikelihood = RA_likelihood.rawValue; //dropdown list 1
var vSeverity = RA_severity.rawValue; //dropdown list 2
var vRisk;
calculateRisk.riskRating(vLikelihood, vSeverity);
console.println("Risk after function = " + vRisk);
RA_risk_rating.rawValue = vRisk;  //this line is meant to assign the value of vRisk from the function to another field (but it doesn't)
//This is the function within calculateRisk script object...
function riskRating(vLikelihood, vSeverity)
    var vRisk;
    if (vLikelihood == null && vSeverity == null)
        vRisk = null;
    else
        vRisk = vLikelihood * vSeverity;
    console.println("Risk inside function = " + vRisk);
    return vRisk;
I have tried various approaches to get the answer back out of the function and to be used for the remainder of the script in the exit event script.
The console show the correct calculation in the function, but it is not updating the variable outside of the function.
Any ideas?
Thanks,
Niall

Niall,
Take a look at the attached. The form contains four numeric fields: 'a', 'b', 'total', and 'other'. It does a calculate on fields 'a' and 'b'. On the exit event of 'b' it calls 'addNumbers()' in 'MyScriptObject'. The function updates 'total' and returns the value of 'total' to be bound to 'other'.
// form1.page1.subform1.b::exit - (JavaScript, client)
other.rawValue = MyScriptObject.addNumbers(a,b,total);
// form1.#variables[0].MyScriptObject - (JavaScript, client)
function addNumbers(a_,b_,total_) {
    return(total_.rawValue = a_.rawValue + b_.rawValue);
Is that what you are looking for?
Steve

Similar Messages

  • Try-catch blocks.  How do you get variables out?

    Hey guys,
    I have several try-catch blocks around potential NumberFormatException's. Well the variables and values given inside the try-catch block can not be used outisde, so how do i get them out or use them outside this block.
    Is there a way to kind of pass it out, or to take the variable outside the try-catch block?
    Gary.

    Declare the variable before the try block:
    public void foo(String number) {
    int i; // Unknown
    try {
    i = Integer.parseInt(number);
    } catch( NumberFormatException e ) {
    e.printStackTrace();
    System.out.println(i);
    variable i might not have been initialized
                   System.out.println(i);
                                      ^
    Or declare the method as throwing the exception so
    that you don't have to handle it directly
    public void foo(String number)
    throws NumberFormatException
    i = Integer.parseInt(number);
    System.out.println(i);
    }Not the best example, in this case. But it works for some things.
    Or make use of the variable within the try block so
    that you limit its scope to the degree possible
    public void foo(String number) {
    try {
    i = Integer.parseInt(number);
    System.out.println(i);
    } catch( NumberFormatException e ) {
    e.printStackTraceException();
    }Definitely missed declaring i, but I like this one best ;~)
    Each has its benefits. Depends what sort of method
    you're writing - if failure of the try block causes
    the whole method to fail, don't try to handle the
    exception locally, put the throws in the signature. ~Cheers

  • Getting GET variables out of outer frame

    Hi
    I currently have a jsp page inside an iframe. When that inner jsp page loads, I would like to get a variable attached to the url of the OUTER frame. Is this possible? If so, how would I go about it?

    Thru Javascript? top is the top level window...
    top.document....

  • Loading Variables in a Class Function

    I am having problems loading variables from an external text
    file inside of a class function. The text file has been created
    properly, and the code that I use in the class is as follows:
    _root.createEmptyMovieClip("texRules", -100);
    loadVariables("texRules.txt", _root.texRules);
    m_Rules = _root.texRules.rules;
    I create an empty movie clip on the root frame named
    texRules, load the variables into that movie clip with the next
    line and then set my member string value equal to the text file
    variable named rules. When I run the program, I get an undefined
    for my m_Rules.
    Here is my texRules.txt:
    rules=THESE ARE THE TEXAS HOLD'EM RULES.
    Any ideas as to what I am doing incorrectly?

    I've opted to use the LoadVars instead of creating an empty
    movie clip and loading the variables there. Here is my new code.
    public function setRules():Void
    var rulesLoader:LoadVars = new LoadVars();
    rulesLoader.onLoad = function (success:Boolean):Void
    if (success)
    trace(rulesLoader.rules);
    this.m_Rules = rulesLoader.rules;
    else
    trace( "Unable to load external file.");
    rulesLoader.load("texRules.txt");
    Here is where I define my properties of my class:
    class TexHoldem extends Game
    //Class member properties
    //Private Properties
    private var m_Rules:String;
    private var m_Target:MovieClip;
    Here is my constructor:
    public function TexHoldem(target)
    this.m_Target = target;
    super("Texas No Limit Hold'Em", 0, 1);
    setRules();
    The setRules function works fine, the only problem now is
    that I can't save the variables once the onLoad function goes out
    of scope. I've thought of modifying it so that it returns a type,
    but that seems difficult. The two easiest solutions I see is to
    create an empty text field that holds the string or find a way to
    get the rulesLoader.rules outside of the onLoad scope. Any
    suggestions now? Sorry to change the problem on you.

  • Payables Open Interface Import getting errors out

    Hello All,
    I am trying to run "Payables Open Interface Import" program to upload the invoice but the program is getting error out, in the log file at the end i am getting the below error:
    (Insert ap inv dists 1a) Inside the insert function
    (Insert ap inv dists 1) Insert into ap_invoice_distributions
    (Insert ap inv dists 1) Insert into ap_invoice_distributions
    ORA-00001: unique constraint (AP.AP_INVOICE_DISTRIBUTIONS_U1) violated
    Insert_ap_inv_dists<-Create_lines<-Import_invoices<- Before report trigger
    (Create Lines 22) Insert into ap_invoice_distributions
    create_non_item_lines<-Import_invoices<- Before report trigger
    Any one faced this kind of issue?
    any suggestions to resolve this.
    Thanks & Regards
    Aboothahir

    Pl post details of OS, database and EBS versions.
    Pl see these MOS Docs
    Payables Open Interface Error ORA-00001: unique constraint (AP.AP_INVOICE_DISTRIBUTIONS_U1) violated          (Doc ID 357784.1)
    APXIIMPT Payables Open Interface Import Fails ORA-00001          (Doc ID 353052.1)
    Unique Constraint Violated Importing Invoices With Multi Line Distribution Set          (Doc ID 386323.1)
    HTH
    Srini

  • HT1454 Can not get video out from my ipod touch 3rd gen. Any ideas? It should nt be diffiicult to do this on the 21 st century, or not?

    After having spent EUR 130 on cables from apple, i still can not get video out from my ipod touch 3rd gen. Any ideas? It should nt be diffiicult to do this on the 21 st century, or not?

    Backing up an iOS device will copy some data to a backup file within iTunes, but this excludes all media.  You can also transfer iTunes Store purchases from the iDevice to iTunes but, without using a third-party tool, nothing else.  As long as you do not sync the iPod with your new library, the media that's on it will remain ... for as long as it keeps functioning, is not lost, stolen, eaten by the dog, ...
    You may also have an option to recover your previous library from your old laptop; as long as its hard drive isn't fried, a computer repair store or technician may be able to extract the drive, mount it in an external enclosure, and copy your data to another PC.  Whatever you choose, there is no real alternative to having all your media on your computer, managed by iTunes, and regularly backed up to another device/location.

  • Xml report getting errored out

    hi friends
    i have one custom xml report with ten parameters whenever i submiteing concurrent program with mandatory paramas it will getting succesfully completed
    without requirement out put. Again whenever i submiteed program with mandatory params and non mandatory parameters it will getting errored out .
    the error was below
    Enter Password:
    MSG-01275: Date select AND afrm.certificate_date BETWEEN :P_FROM_DATE and :P_TO_DATE
    01-OCT-11 31-DEC-11
    REP-1276: Placeholder 'CP_PARENT_NAME' references one or more non-formula columns.
    REP-0069: Internal error
    REP-57054: In-process job terminated:Terminated with error:
    REP-1276: Placeholder 'CP_PARENT_NAME' references one or more non-formula columns.
    thanks
    chandra

    Hi Chandra,
    There might be a problem with your .rdf.
    Please check the formula column and use srw.message functionality to debug.
    And please enable Trace option while you are running the report.
    So that you can get more info about the errors.

  • Huge Problem: How to get Information out of the SAP System into MySQL?

    Hi all
    Im totally despaired... So im comming here, hoping to find ANY solution.
    I wrote a Program, which creates a internal Table wich some information from many DDIC-Tables. The internal Table is about 7 Columns, with only char fields.
    Also I have a MySQL Server (reached through the Internet), with a database on it, and a table, which looks 1:1 as my internal Table in ABAP does.
    Now I want to append the Data from the internal Table to the MySQL Table.
    Is there ANY chance of getting this done?
    and btw. can I append this Data with a secured connection?
    THX for help...
    greets
    Markus Voelker

    Think of Orchestrator as a "router", that will route information and workflows between SCOM, and [insert 3rd party product here].  Depending on your 3rd party product, there may be an "integration pack" for it that Orchestrator can use for out of the
    box tasks.
    So what's an integration pack?  Well - think of it like a management pack, but for Orchestrator.  SCOM does monitoring, but it doesn't know how to monitor something unless you install the relevant management pack.  The management pack contains
    all the rules/monitors for monitoring whatever it is you wish to monitor.
    Well, an integration pack is similar in concept, except it tells Orchestrator how to interface and integrate with whatever it is you're trying to perform tasks with. 
    For what you want to do, there is a SCOM integration pack.  This is a set of tasks that can get alerts and events out of Operations Manager (there are also tasks that can create and close alerts in Operations Manager). 
    From what I can imagine - you would want to get alerts out of SCOM when they happen (so you would use one of the SCOM orchestrator tasks to "get alert if status = new, and source = myapplication"), and then you can pass that alert to another task - such
    as write it to a CSV file or something.  You could then have another task that picks up that CSV file, and passes it to your application where it can be captured.  Or you could use the CSV to populate variables in a powershell script, and then powershell
    that information into your app.
    There are many ways you could do this, but I do believe that Orchestrator would be the better option. 
    http://www.dreamension.net

  • Can't get sound out of safari

    hey all,
    i am not able to get sound out of my mac?! And thats only on Safari. I cant watch any videos now! please help.
    thanks in advance

    Hi
    I'm far from an expert on "sound" issues. I believe OS X's sound file is designed to be functional for 16 bit sound files, not 24 bit. 24 bit sound file offer enhanced sound quality, but are larger in size. Perhaps not yet practical for web sites.
    explaining the difference between the two settings.
    Thanks for the green star.
    Aloha from Big Island
    iMac G5 Rev C 20" 2.5gb RAM 250 gb HD/iBook G4 1.33 ghz 1.5gb RAM 40 gb HD   Mac OS X (10.4.9)   Seagate 300 gb ext. HD Canon i960 printer, Airport Express (2 units)

  • How  to get  response from such a  function

    How  to get  response from such a  function (in MODULE USER_COMMAND_0010 INPUT I get "ODGOVOR" 'X'
    FUNCTION Z_SEENKRAT.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(ODGOVOR) TYPE  MSEG-KZEAR
    DATA ok_code LIKE sy-ucomm.
    DATA: test like mseg-kzear.
    BREAK-POINT.
    call screen 10.
    test = ODGOVOR.
    ENDFUNCTION.
    *&      Module  CLEAR_OK_CODE  OUTPUT
          text
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.                 " CLEAR_OK_CODE  OUTPUT
    *&      Module  USER_COMMAND_0010  INPUT
          text
    MODULE USER_COMMAND_0010 INPUT.
    DATA odgovor LIKE mseg-KZEAR.
    CASE ok_code.
        WHEN 'DA'.
        ODGOVOR = 'X'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0010  INPUT

    Hi,
    You need to declare the ODGOVOR variable in the TOP include, then you will get the value
    Regards
    Sudheer

  • How to get String out of  void method

    I have a problem to get String out of void method. I override method actionPerformed(), and I need to use String from this method in other methods. I get nothing in smth. Can anyone help me with this.
    class
    StringBuffer smth = new StringBuffer();
    StringBuffer s;
          public void actionPerformed(ActionEvent event){
              String vnos;
              if(event.getSource() == btn_vnos){
                   input = field.getText();
                   s = new StringBuffer(input);
                    smth = s;
                }             Thanks

    You have needs to use a static variable or somehow pass an instance reference, through a list or array or some such thing, perhaps through the constructor. Or think up some other jazz, like adding a method "public String getMyStinkin'String" ;~)
    ~Cheers

  • How to use variable in the LIKE function along with % operators

    Hi,
    Is there any way i can use the variable in the Like function. That means i have query like
    SELECT * FROM Device WHERE DeviceName LIKE %v_MediaName%;
    Here "v_MediaName" is the userdefined variable which contains string. I want to retrieve all the records from the "DEVICE" table whose DeviceName LIKE %v_MediaName%;
    If i put it in a single quotes '%v_MediaName%' then the v_MediaName will be treaded as a string instead of a variable. I am using this query in a Procedure.
    please help me out to resolve the issue.
    thanks

    LIKE '%'||v_MediaName||'%';
    Will not make use of the indexes though.
    Message was edited by:
    satishkandi

  • How can I pass variable to eventdriven startElement() function?

    I am new to java and SAX. Could anybody tell me how to pass variable to eventdriven startElement function? I tried the following code but didn't work.
    public class ReadXmlSax extends DefaultHandler
    String elementName;
    String requestName;
    Vector v = new Vector();
    public Enumeration getAttribute(String sFileName, String sTagName, String sAttrName)
         Enumeration e;
         elementName=sTagName;
    requestName=sAttrName;
    File f = new File(sFileName);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new ReadXmlSax();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse(f, handler);
    } catch (Throwable t) {
    t.printStackTrace();
    e = v.elements();
    return(e);
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    public void endDocument()
    throws SAXException
    public void startElement(String namespaceURI,
    String sName, // simple name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
              //System.out.println(elementName);
              if (qName.equals(elementName))
                   String serverName = attrs.getValue("",requestName);
                   v.addElement(serverName);
    }

    I attached the main call the ReadXmlSax class. I added the
    "system.out.println(elementName);" in the function getAttribute and startElement as well. I got printing out "name" for elementName from function getAttribute but got others printing out "null" for elementName from function startElement. Any suggestions? thanks
    import java.io.*;
    import java.util.*;
    import ReadXmlSax;
    public class ReadElement
         public static void main(String argv[])
              ReadXmlSax r = new ReadXmlSax();
              Enumeration e = r.getAttribute("dre.xml","server","name");
              try{
                   while (e.hasMoreElements()) {
                   System.out.println((String)e.nextElement());}
              }catch(Throwable t){
                   t.printStackTrace();
    <strong>test</strong>

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • Variable screen in Planning Function for Integrated Planning

    Hi all.
    I have created a planning application with the WAD, based on an Input_ready Query. Manual planning works fine and even planning functions go well, using the command wizard.
    However, if I try to use a variable in a planning function and I set the parameter to pop-up the variable screen within the command wizard for a planning function, I get an 'uncaught exception'. An almost blank IE-window pops up which is supposed to display the variables, but it fails.
    Does anybody know how to solve this?
    Gr.,
    Marc.

    Hello Marc,
    do you still have this error? I encountered the same problem with SPS 9. Maybe you should install at least SPS 10. The variable popup works correct there.
    Best regards
    Martin

Maybe you are looking for

  • JPEG import into After Effects 6.5/7 over Xsan

    We are unable to import any type of .jpg file into After Effects over the Xsan file system. When attempting to do so we only receive a slew of bogus error messages and the files will not import, tiff files or other formats are fine. This issue plague

  • Illustrator 10 - "the encoding (CMap) specified by a font is missing"

    Ni hao, I'm trying to design a brochure in Illustrator 10 using Chinese characters. I'm running Leopard 10.5.8 on a PowerPC G4. I have my Chinese text in a Word document in the 'Hei' font. I am able to successfully copy and paste the Chinese text int

  • T430s, device without driver, wrong driver selection or other problem

    Hi all, I've got the problem that under device manager there's a device without driver and is thus shown with a yellow exclamation mark. Vendor ID is 1180, device ID is E822, so it seems to be the Ricoh PCIe SD/MMC Host Controller. But if I download

  • How to run a script op Indesign startup?

    Hi, I have a script that runs fine when manually running it in inDesign CC. Now i need that script to run automatically when a file is opend in InDesign. I put the script in "stratup scripts" folder. But get the error that there is no active document

  • Server0 process restarted and failed

    Hi All,   The server0 process giving the error; the dev_server0 contains the following information: Thr 6068] Tue Mar 10 16:16:04 2009 [Thr 6068] JHVM_RegisterNatives: registering methods in com.sap.mw.rfc.driver.CpicDriver [Thr 6068] Tue Mar 10 16:1