Variable number of arguments in C functions

Hello. I know how to achieve creating a function that accepts a variable number of arguments. For example:
#include <stdio.h>
#include <stdarg.h>
int add (int x, ...);
int main (int argc, const char * argv[])
int result = add(3, 5, 3, 7);
printf("%d", result);
return 0;
int add (int x, ...)
va_list argList;
va_start(argList, x);
int sum = 0;
int i;
for (i = 0; i < x; ++i)
sum += va_arg(argList, int);
va_end(argList);
return sum;
The first argument, x, is sent to the function and represents how many additional optional arguments will be sent to the function (3 in the above example). Then, the definition of the add function totals those remaining (3) arguments, returning a value of (in this case) 15, which main then prints to the console. Simple enough, but here's my question:
What if I want to achieve this same optional arguments concept without having to send the function the number of optional arguments it will be accepting. For example, the printf() function takes an optional number of arguments, and nowhere there do you have to specify an extra argument that represents the number of additional optional arguments being passed (unless maybe the number of formatting specifiers in the first argument determines this number). Can this be done? Does anyone have any input here? Thanks in advance.

Hi Tron -
I looked over my first response again, and it needs to be corrected. Fortunately Bob and Hansz straightened everything out nicely, but I still need to fix my post:
RayNewbie wrote:
Yes, the macros are designed to walk a list of args when neither the number of args or their type is known.
The above should have said. "The macros are designed to walk a list of args when neither the number of args or their type is known _at compile time_".
If I may both paraphrase and focus your original question, I think you wanted to know if there was any way the function could run without knowing the number of args to expect. The answer to this question is "No". In fact at runtime, the function must know both the number of args and the type of each.
Tron55555 wrote:
... the printf() function takes an optional number of arguments, and nowhere there do you have to specify an extra argument that represents the number of additional optional arguments being passed (unless maybe the number of formatting specifiers in the first argument determines this number).
As both Bob and Hansz have explained, the underlined statement is correct. Similarly, the example from the manual gives the number and types of the args in the first string arg.
Hansz also included an alternative to an explicit count or format string, which is to terminate the arg list with some pre-specified value (this is sometimes called a "sentinel" value. However when using a sentinel, the called function must know the data types. For example, you could never simply terminate the args with a sentinel and then pass a double followed by an int. The combined length of these args is 8 + 4 => 12 bytes, so unless the function knew which type was first at compile time, it wouldn't be possible to determine whether the list was 4+8 or 8+4 at runtime.
If you're interested in knowing why a variable arg function is limited in this way, or in fact how any C function finds its args, its parameters, and how to return to the calling function, you might want to do some reading about the "stack frame". You can learn the concept without getting into any assembler code. Here's an article that might be good to start with: [http://en.citizendium.org/wiki/Stack_frame].
After you have some familiarity with the stack frame, take a look at the expansions of the stdarg macros and see if you can figure out how they work, especially how va_arg walks down the stack, and what info is required for a successful trip. Actually, I don't think you can find these expansions in the stdarg.h file for Darwin; it looks like the #defines point to built-in implementations, so here are some typical, but simplified defs:
// these macros aren't usable; necessary type casts have been removed for clarity
typedef va_list char*;
#define va_start(ap,arg1) ap = &arg1 + sizeof(arg1)
#define va_arg(ap,type) *(ap += sizeof(type))
#define va_end(ap) 0
Note that I"m trusting you not to start asking questions about the stack or the above macros until you've studied how a stack works and how the C stack frame works in particular.
- Ray

Similar Messages

  • Can we write function with variable number of argument

    Hi
    Can anybody tell that can we pass variable number of arguments to a function in oracle 10gR2.
    As in function decode we can pass variable no. of arguments upto 255 arguments, similarly can we creat a function which accept any no. of variables.

    I'm not sure that this is what you were asking about, but depending on the logic you want to implement, you can declare the maximum possible number of parameters to your function, give them default values, and then pass to your func as many parameters as you want:
    SQL> create or replace function test(p_a number:=null, p_b number:=null) return varchar2 is
      2    Result varchar2(100);
      3  begin
      4    result:='a='||p_a||', b='||p_b;
      5    return(Result);
      6  end test;
      7  /
    Function created
    SQL> select test() from dual;
    TEST()
    a=, b=
    SQL> select test(1) from dual;
    TEST(1)
    a=1, b=
    SQL> select test(1,2) from dual;
    TEST(1,2)
    a=1, b=2
    SQL> drop function test;
    Function dropped
    SQL>

  • Variable number of arguments in procedure PL/SQL

    Hello everyone,
    I have a "simple" question : can a procedure PL/SQL take a variable number of arguments ?
    In my case, the procedure is called by the submit button of a form, and the form has variable number of inputs...
    Thanks you !

    862447 wrote:
    I have a "simple" question : can a procedure PL/SQL take a variable number of arguments ?No. Not in the style of Pascal and C/C++. E.g. int printf( char * format, … ) in C using va_list.
    In my case, the procedure is called by the submit button of a form, and the form has variable number of inputs...There are a couple of merhods.
    Code a fixed number of parameters in the procedure signature. Assign defaults to these. The caller can now select which parameters from the fixed list to use and which not.
    Create a structure. For example, having a 100 parameters in a signature is something I will call plain stupidity. This creates usability issues, maintenance issues and even performance issues. And debugging will be a nightmare. So instead create a structure (aka record in the PL/SQL language or an object using the SQL language) - where this structure describes (in a structured and logical way) the list of parameters.
    Neither of these method however allows the caller to pass a variable number parameters - the parameter signature is fixed. It has a fixed number of defined parameters.
    So the only way to simulate a variable parameter signature is to use a collection. The collection itself is of course a single parameter passed. But it can have 0 elements. It can have a 1000 elements. And similar to a va_list in C/C++, the procedure can iterate through the data passed via the parameter by the caller.
    Simple example:
    //-- define the collection type, e.g. a collection of strings
    create or replace type TStrings is table of varchar2(4000);The procedure's signature:
    --// passing by referencing and not value should be considered
    create or replace procedure FooProc( param TStrings ) is ..And to call this procedure with variable parameters:
    --// calling it with 2 param value
    FooProc( TString('123','testing') );
    --// calling it with 5 param values
    FooProc( TString('p1','p2','p3','p4','p5') );

  • Passing variable number of arguments in a stored procedure

    Hi Team,
    i am facing a problem. I have a dynamic form which contains some checkboxes. The number of checkboxes are dynamically generated on querying the database. On the form submission i want to call a stored procedure that will update the values in the database. i want to know that is there any way to handle variable number of arguments in the stored procedure or can i get the variables through some session context and use it in my stored procedure.
    Any help is greatly appreciated.
    Thanks&Regards
    Saurabh Jain

    Hi Saurabh,
    The method in which stored procedures are called on form submit is something as follows.
    Let us take your scenario of a form which has multiple checkboxes and a submit button. On clicking the submit button, this form data is submitted using either get or post. The form's submit action invokes a procedure.
    The HTML form code will look something like this..
    htp.formOpen( curl => 'URL /myProcedure',
    cmethod => 'post' );
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'A');
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'B');
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'C');
    htp.formSubmit( cname => 'myButton',
    cvalue => 'OK');
    Now, whenever the submit button is clicked, all these form values are passed to our stored procedure 'myProcedure'.
    "myProcedure" looks something like this.
    procedure myProcedure
    myCheckbox IN sys.owa_util.vc_arr,
    myButton IN VARCHAR2
    is
    begin
    end myProcedure;
    The point to be noted here is that the name of the variable being passed in the procedure is the same as the name of the HTML element being created in the HTML form. So, there is a direct mapping between the elements in the HTML form and the procedure parameters.
    Another noteworthy point is that since you have multiple checkboxes in your HTML form, it is impractical to name all the checkboxes differently and then pass those many parameters to your procedure (Imagine a scenario where there are a hundred check-boxes in an HTML form!). So portal allows you to give the same name (cname) to all the checkboxes in your HTML form, and if multiple checkboxes are checked, it will return all the checkbox values in an array (Note the usage of "myCheckbox IN sys.owa_util.vc_arr" in myProcedure).
    You can check out this link for more information.
    Re: retrieving data from fields
    Thanks,
    Ashish.

  • Variable number of arguments in DML

    In my OLAP DML program, I need to take variable number of arguments. I took the number of inputs as one argument and then tried to take succeeding inputs as arguments in a while-loop, but got an error saying "All ARGUMENT statements must precede the first non-declarative"
    Can you suggest a way in which I can take variable number of arguments in an OLAP DML program?

    This any use:
    DEFINE ARG.TEST PROGRAM
    blank
    shw joinchars('Number of Arguments Passed: ' ARGCOUNT)
    blank
    blank
    shw joinchars('Argument 1: ' arg(1))
    shw joinchars('Argument 2: ' arg(2))
    shw joinchars('Argument 3: ' arg(3))
    shw joinchars('Argument 4: ' arg(4))
    blank

  • Maximum number of Arguments in Javascript function

    Is there a way to handle large number of arguments to a Javascript function ?
    abhay

    Hello,
    Well this is more a pure javascript question than a HTML DB you should ask google.
    But it depends what you are doing with your function, if each value is a specific variable then no your function will have to look like f(nul,null,null,1,null,null,null,.........) .
    If you are using them to populate an js array you can iterate through your arguments or just provide the array are your argument.
    Personally and I do know a little about javascript I would avoid like the plague any js function that requires 50 arguments ( i usally start looking at a different solution at abut 10 arguments) especially if most of them could be null, there absolutely has to be a better way to do it.
    Like breaking up into smaller more specific functions or creating a js object that is more robust, agian you should ask google.
    Carl

  • Can not pass CString variable as value argument to exported function in library

    I have extension library having following function exported
    __declspec(dllexport) int MyMessageBox(CString & csText, CString csCaption, const int iMsgType);
    The linker error is coming for second argument when I try to call the function from client.
     error LNK2001: unresolved external symbol "int __cdecl MyMessageBox(class ATL::CStringT<unsigned short,class StrTraitMFC_DLL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > &,class ATL::CStringT<unsigned short,class
    StrTraitMFC_DLL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > &,int)" (?MyMessageBox@@YAHAAV?$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@@@@ATL@@0H@Z)
    I have checked project settings for both(client as well as DLL) and I think it may not an issue as both are using same character set and linker settings.
    Please help. 

    On 3/26/2015 9:01 AM, AtulPP wrote:
    I have extension library having following function exported
    __declspec(dllexport) int MyMessageBox(CString & csText, CString csCaption, const int iMsgType);
    The linker error is coming for second argument when I try to call the function from client.
      error LNK2001: unresolved external symbol "int __cdecl MyMessageBox(class ATL::CStringT<unsigned short,class StrTraitMFC_DLL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > &,class ATL::CStringT<unsigned short,class
    StrTraitMFC_DLL<unsigned short,class ATL::ChTraitsCRT<unsigned short> > > &,int)" (?MyMessageBox@@YAHAAV?$CStringT@GV?$StrTraitMFC_DLL@GV?$ChTraitsCRT@G@ATL@@@@@ATL@@0H@Z)
    Use Dependency Walker (http://www.dependencywalker.com/) or dumpbin to discover the decorated name under which the function is actually exported from the DLL, compare with the one the linker
    is complaining about.
    What compiler version are you using? Seeing "unsigned short" where one would expect wchar_t is suspicious. VC6 did that (lacking a built-in wchar_t type), but it wouldn't have things like StrTraitMFC_DLL. I suspect you are building one of the
    two modules with /Zc:wchar_t- (Project > Properties > C/C++ > Language > Treat wchar_t As Built-in Type = No).
    Igor Tandetnik

  • Error: Illegal number of arguments passsed to the function call

    HI All,
    In our scenario we are using XSLT mapping with java enhancement.Its working fine in Stylus studio but when the same is imported into XI its throwing the below mentioned error:
    javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Illegal number of arguments or types of arguments in a call of function 'Trans:Convert'.
    Our requirement is that we are summing up the field "Grant_Amount" which occurs multiple times in the source structure and the sum is mapped to the field "Sum' on the target side.The stylesheet is working fine in stylus studio but whe  imported into XI the above mentioned error is being thrown.Can any one one please help me solving this issue.
    The XSL, the source XMLand the java class are mentioned below:
    <
    XSL:
    ===
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.infosys.com/sap/xi/projects/sce/n1" xmlns:Trans="com.company.group.String2Number">
         <xsl:template match="/">
              <a:MT_TargetXSLJava>
              <Record>
                   <Detailrecord>
                         <Sum>
                      <xsl:value-of select="Trans:Convert(//Grant_Amount)"/>
                         </Sum>
                          <Flag>
                     <xsl:text>1</xsl:text>     
                          </Flag>
                  </Detailrecord>
              </Record>
              </a:MT_TargetXSLJava>
         </xsl:template>
    </xsl:stylesheet>
    XML:
    ===
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_SourceXSLJava xmlns:ns0="http://www.infosys.com/sap/xi/projects/sce/n1">
       <Recordset>
          <DETAILRECORD>
             <Grant_Amount>$100.00</Grant_Amount>
          </DETAILRECORD>
          <DETAILRECORD>
             <Grant_Amount>$200.00</Grant_Amount>
          </DETAILRECORD>
          <summary_record>
             <Total>$300.00</Total>
          </summary_record>
       </Recordset>
    </ns0:MT_SourceXSLJava>
    Java Code:
    ========
    package com.company.group;
    public class String2Number
    public static double Convert(String[] a)
    double sum=0;
    String[] temp = new String100;
    for(int i=0;i<a.length;i++)
    temp = (a).replaceAll(",
    $
    sum=sum+Double.parseDouble(temp);
    return sum;
    Please guide me to the right solution.
    Thanks and Regards,
    Karanam

    If you are using below mentioned java code for Convert method, then see you are passing a String Array, but in below statement:
    <xsl:value-of select="Trans:Convert(//Grant_Amount)"/>
    This is just a single value i think, you have to pass an array with values 100,200,300. Pls check it.
    BR,
    Alok

  • Error: An insufficient number of arguments were supplied for function

    Hi ,
    I changed the data source for a data set on my report . The data source  is still pointing to same server and database but I am getting this error 
    "An error occurred during local report processing
    Query execution failed for data set 'Data Set Name'
    An insufficient number of arguments were supplied for function "
    I checked the function number of arguments again and it was correct and even executed the function in the dataset query designer and it works fine.
    any ideas for the reason for this error ?

    Without seeing the query you use or function its hard to suggest.
    See if parameter passed from SSRS has expected values. Is there some multivalued parameters involved?
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • There is an invalid number of arguments found in the function '@PARENTVAL

    Hi
    In a prior version of Hyperion, we had a business rule which pushed values down to to a child member
    +Fix ( EE105, , @Children("FX entry"), &District, @UDA("Cost centre - primary", "DuplicateMbr"),C3090,[Opex_WriteScenario], [Opex_WriteVersion],&CurYear: &YearPlus6)+
    Month = @PARENTVAL("Cost Centre");
    Endfix;
    We are moving across to Calc Manager in version 11.1.2.1 and the problem is that I now get the following error message:
    An error occurred in: Calc Opex CC
    There is an invalid number of arguments found in the function '@PARENTVAL(Cost Centre)'. .
    Your assistance is appreciated.
    Cheers

    Check if you can validate this script again Essbase, I am sure you will be able to.
    If I remember correctly there were few functions missing in calc manager which were fixed in the patches released.
    Try it on the latest patch:
    Patch 14265667: Patch Set Update: 11.1.2.1.104 for Oracle Hyperion Calculation Manager
    Cheers..!!!
    Rahul S.

  • How execute a dynamic statement with a variable number of bind variables

    Hi all.
    I would like to execute SQL statements in a PL/SQL function.
    SQL statements must use bind variable in order to avoid parsing time. But the number of arguments depends on the context. I can have from 10 to several hundreds of arguments (these arguments are used in a 'IN' clause).
    To minimise the number of differents signature (each new signature involve a parsing), the number of argument is rounded.
    My problem is : how to set dynamicaly the bind variables ?
    Cause it is pretty simple to construct dynamicaly the SQL statement, but using an
    " OPEN .... USING var1, var2, ..., varX "
    statement, it is not possible to handle a variable nomber of bind variable.
    I am looking for the best way to do the same thing that it can be done in java/JDBC with the PreparedStatement.setObject(int parameterIndex, Object x).
    I saw the dbms_sql package and bond_variable procedure : is a the good way to do such a thing ?
    Thanks

    If the variation is only values in an IN list, I would suggest using an object type for the bind variable. This lets you have just one bind variable, regardless of how many values are in the IN list.
    The dynamic SQL ends up looking like:
    ' ... where c in (select * from table(:mylist))' using v_list;where v_list is a collection based on a SQL user-defined type that can be populated incrementally, or in one shot from a delimited list of values using a helper function.
    I use this approach all the time in dynamic searches.
    See this link for more details:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:110612348061

  • Variable No. of Arguments

    How we can pass variable no. of arguments in JAVA (like in C/C++)
    where arguments are different type?
    To pass similar data type, we declare function as follows:-
    <type_specifier> function_name(Object vna...) {
    <function_body>;
    }

    cotton.m wrote:
    gajesh wrote:
    How we can pass variable no. of arguments in JAVA (like in C/C++)
    where arguments are different type?In my opinion you should stop now and really consider if this is a good idea. (It isn't). Do you really want a method that can take any number of variables of any type? (You don't). What kind of code will your method need to deal with this (a lot of ugly instance of probably).
    This is just not a good idea. I would suspect you want to do this in the name of some sort of "flexibility" but if so this is the wrong way to approach this and your design needs a rethink.I would also assume he simply wants to have a set parameter string that he can use in every method declaration he writes, so that he doesn't have to bother about any sort of restrictions. Who cares about all the problems that might (will) cause with every other aspect of the program though. ;-)

  • Incorrect number of arguments expected 1

    Hi,
    I'm new to this flex. Actually i want to set busycursor in loadValue Function. But i'm getting error as Here i'm getting an error as incorrect number of arguments expected 1.
    the error that i'm getting in 3rd line. and i have not pasted full code here. But i pasted only where i'm getting error when i tried to inser busyCursor.
    So please help me what i hv to change. waiting for your replay.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
              creationComplete="loadValues()" horizontalAlign="center"      --------------->  Here i'm getting an error as incorrect number of arguments expected 1.
              verticalAlign="middle"  color="#080808" borderColor="#FFF8E0" backgroundColor="#FFF8E0"
              xmlns:local="*"
              xmlns:tInput="assets.actionScript.*"
              xmlns:controls="com.iwobanas.controls.*"
              initialize="initTimer()"
              xmlns:dataGridClasses="com.iwobanas.controls.dataGridClasses.*"
              applicationComplete="init(event)" height="100%" width="100%">
    <mx:Style source="defaults.css" />
    <mx:Script>  
              <![CDATA[
                        import assets.actionScript.Trim;
                        import com.scottlogic.charts.DataGridExporter;
                        import mx.controls.ComboBase;
                        import assets.script.pods.view.Data;
                        import org.alivepdf.layout.Unit;
                        import mx.collections.ICollectionView;
                        import assets.actionScript.EscalationDTO;
                        import alarmSlide.TowerSelection;
                        import flash.net.navigateToURL;
                        import mx.binding.utils.BindingUtils;
                        import mx.controls.dataGridClasses.DataGridItemRenderer;
                        import mx.events.ListEvent;
                        import mx.charts.chartClasses.DualStyleObject;
                        import assets.actionScript.TowerInchargeRoleMappingDTO;
                        import flash.utils.clearInterval;
                        import flash.utils.setInterval;
                        import alarmSlide.SendMessageForEscalation;
                        import mx.skins.halo.BusyCursor;
                        import alarmSlide.REForAlarmReport;
                        import mx.managers.ToolTipManager;
                        import mx.controls.ToolTip;
                        import mx.collections.SortField;
                        import mx.collections.Sort;
                        import mx.messaging.messages.RemotingMessage;
                        import mx.events.AdvancedDataGridEvent;
                        import assets.actionScript.TowerStatus; 
                        import mx.rpc.events.FaultEvent;
                        import mx.rpc.events.ResultEvent;
                        import assets.actionScript.ValueObject;
                        import mx.messaging.channels.AMFChannel;
                        import alarmSlide.LEDChar;
                        import mx.utils.URLUtil;
                        import com.adobe.serialization.json.JSON;
                        import com.adobe.serialization.json.JSONDecoder; 
                        import mx.collections.ArrayCollection;
                        import mx.collections.IViewCursor;
                        import mx.collections.IHierarchicalCollectionView;
                        import mx.controls.Alert;
                        import mx.managers.PopUpManager; 
            import flash.net.FileReference;
                   import mx.messaging.messages.IMessage;
                  import mx.messaging.Channel;
                  import mx.messaging.ChannelSet;
                  import mx.messaging.channels.StreamingAMFChannel;
                        import flash.display.StageDisplayState;      
                        import mx.collections.ArrayCollection;
                        import mx.managers.CursorManager;
                        private var sendMessageScreen:SendMessageForEscalation;
                        private var escalationAlarmHistoryPopup:EscalationAlarmHistoryPopup;
                        public var manualOrScheduleTicketing:ManualOrScheduleTicketing;
                        public var editEscalationLevelPopup:EditEscalationLevelPopup;
                        private var escalationLevelPopup:EscalationLevelPopup;
                        private var escalationSiteDetailsPopup:EscalationSiteDetailsPopup;
                        [Bindable] private var towerName:String = "NoData";  
                        [Bindable] private var contactNumber:String = "NoData";
                        // Data Storgae variables
                        [Bindable] private var energyConsumption:ArrayCollection = new ArrayCollection();
                        [Bindable] public var dataColl:ArrayCollection = new ArrayCollection();
                        [Bindable] public var closedTicketArrayColl:ArrayCollection = new ArrayCollection();
                        [Bindable] private var towerDetails:ArrayCollection = new ArrayCollection();
                        [Bindable] private var escalationData:ArrayCollection = new ArrayCollection();
                        [Bindable] public var escalationLevelDetails:ArrayCollection = new ArrayCollection();
                        [Bindable] public var towerEscalationLevelDetails:ArrayCollection = new ArrayCollection();
                        [Bindable] private var escalationMasterList:ArrayCollection = new ArrayCollection();
                        [Bindable] public var alarmDetailsList:ArrayCollection = new ArrayCollection();
                        [Bindable] public var siteInformationList:ArrayCollection;
                        [Bindable] public var communicationInfoList:ArrayCollection;
                        [Bindable] public var operatorDetailsList:ArrayCollection;
                        [Bindable] public var siteLiveDataList:ArrayCollection;
                        [Bindable] public var siteLiveAlarmDetailsList:ArrayCollection;
                        [Bindable] public var ticketEscalationStateList:ArrayCollection = new ArrayCollection();
                        [Bindable]
                        public var siteAndDistrictDisplayName:String="";
                        public var categoriesArrColl:ArrayCollection = null;
                        public var tempArrColl:ArrayCollection = null;
                        public var userID:int = 0;
                        public var customertId:int = 3;
                        private var popupWin:PopupForTicketing;
                        // to store tower configuration
                        public static var data:ArrayCollection = new ArrayCollection();
                        private var intervalUnit:uint;
                        [Bindable]  
                        public var folderList:XMLList;
                        // BlazeDS variables
                 [Bindable] public var channelUrl:String;  
                  [Bindable] public var liveId:int=0;
                           [Bindable]
                           public var emailOrSmsMessageFormat:String = "";
                        [Bindable]
                        private var escalationEditOption:Boolean = false;
                        [Bindable]
                        private var swapCount:int = 0;
    //  ---------------------------- To Control Session ------------------------- //
            public var myTimer:Timer;
                        private function initTimer():void
                                   myTimer = new Timer(1800000);
                             myTimer.addEventListener("timer",logout);
                             this.addEventListener(MouseEvent.MOUSE_MOVE, resetTimer);
                             myTimer.start();
                        private function logout(event:Event):void
                                  this.addEventListener(MouseEvent.CLICK,forward);
                        private function forward(event:Event):void
                                  navigateToURL( new URLRequest("jsp/checkin/index.jsp"),"_self");
                        private function resetTimer(event:Event):void
                                  myTimer.reset();
                            initTimer();
    //  ---------------------------- To Control Session ------------------------- //
                            * This method will be called as soon as SWF loads in the browser , creating a AMF channel which communicates to Java
                            private function loadValues(mouse:MouseEvent):void{   ----------------------------------------------------------------->> When i enter Event to the loadvalues function i'm getting that error
                                            ticketViewStack.selectedChild = liveTicketVBox;
                                      userID = Application.application.parameters.userId;
                                      customertId = Application.application.parameters.customerId;
                                             if("true" == Application.application.parameters.escalationEditOption.toString()){
                                                escalationEditOption = true;
                                            channelUrl = "./messagebroker/amf";
                                             userID = 92;
                                      customertId = 3;
                                               escalationEditOption = true;
                                              channelUrl = "http://172.16.1.144:5009/messagebroker/amf";
                                var cs:ChannelSet = new ChannelSet();
                                            var customChannel:AMFChannel = new AMFChannel("my-amf",channelUrl);
                                            cs.addChannel(customChannel);
                                            remoteObject.channelSet = cs;
                                            remoteObject.getEscalationMaster();
                                            cursorManager.setBusyCursor();
                                            remoteObject.getAllLiveEscalationDetails(userID,customertId,displayTo wer.selectedItem.data,ticketType.selectedItem.data);
                                            cursorManager.removeBusyCursor();
                                            displayTower.selectedIndex = 0;
                                            refereshTime.selectedIndex = 0;

    Hi, Actually i did changes like show below.
    i made creationComplete="loadValues()"
    And i made
    private function loadValues():void
    I want to  set a busy cursor, But its not working.
    Actaully the loadValues() function will load the data when we open that perticular page.but it;ll take some time to load so that i want to put busy cursor. In above Code i used busy cursor but its not working.

  • Possible to do variable number of REPLACE in SQL?

    Hello. Using Oracle 10G, R2
    Wondering if it is possible to do a variable number of REPLACE() entirely in SQL in a view.
    input_table.text_column = This (b)is(/b) some (i)text(/i) with (u)formatting(/u) codes
    Note: Using ( and ) to represent < and >
    rows in format_codes_table:
    (b)
    (/b)
    (i)
    (/i)
    (u)
    (/u)
    (p)
    (/p)
    etc. (The number of format_codes is not fixed)
    Desired output: This is some text with formatting codes
    This could be done with a user-defined function and then use that function in a SQL:
    create or replace function remove_format_codes(input_p IN varchar2)
    return varchar2
       v_output   varchar2(2000);
    is
    begin
       v_output := input_p;
       for r1 in (select format_code from format_codes_table)
       loop
          v_output := replace(v_output, r1.format_code);
       end loop;
       return v_output;
    end;
    create or replace view unformatted_output_vw
    as
    select remove_format_codes(input_table.text_column) as unformatted_output
    from input_table
    /I tried this SQL:
    select replace(input_table.text_column, format_codes_table.format_code) as unformatted_output
    from input_table
        ,format_codes_table
    /But it only replaces one format code at a time, and it is not recursive so the output is like this:
    This is(/b) some (i)text(/i) with (u)formatting(/u) codes
    This (b)is some (i)text(/i) with (u)formatting(/u) codes
    This (b)is(/b) some text(/i) with (u)formatting(/u) codes
    This (b)is(/b) some (i)text with (u)formatting(/u) codes
    etc.
    I've google'd Oracle recursive sql, looked at CONNECT BY, LEAD, LAG, MODEL, and I've also looked at a
    Tom Kyte example for varying in lists (http://tkyte.blogspot.com/2006/06/varying-in-lists.html),
    but I can't seem to find a way to replicate the loop in my user-defined function in SQL.
    Anyone think this is possible in SQL? If yes, any hints?
    Thanks

    Hi,
    Regular expressions (introduced in Oracle 10) are great for this:
    SELECT     REGEXP_REPLACE ( text_column
                     , '&lt;'          || -- left angle-bracket
                       '/?'          || -- optional slash
                    '[bipu]'     || -- any one of these characters
                    '>'             -- right angle-bracket
                     )      AS no_tag_text
    FROM    input_table
    ;You had some good ideas: recursive subqueries (new in Oracle 11.2), CONNECT BY and MODEL could also do this job, but not nearly as easily.
    In case you're interested, the following thread uses MODEL to do nested REPLACEs:
    SQL Query
    Edited by: Frank Kulash on May 13, 2010 4:08 PM
    Edited by: Frank Kulash on May 17, 2010 1:02 PM
    Fixed link

  • Errror::Illegal number of arguments or types of arguments in XSLT

    HI All,
    In our scenario we are using XSLT mapping with java enhancement.Its working fine in Stylus studio but when the same is imported into XI its throwing the below mentioned error:
                     javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: Illegal number of arguments or types of arguments in a call of function 'Trans:Convert'.
    Our requirement is that we are summing up the Field "Grant_Amount" which occurs multiple times in the source structure.PFB the XSL and the source XML:
    <
    XSL:
    ===
    <Sum>
          <xsl:value-of select="Trans:Convert(//Grant_Amount)"/>
    </Sum>
    XML:
    ===
    <Recordset>
          <DETAILRECORD>
             <Grant_Amount>$100.00</Grant_Amount>
          </DETAILRECORD>
          <DETAILRECORD>
             <Grant_Amount>$200.00</Grant_Amount>
          </DETAILRECORD>
    </Recordset>
    Java Code:
    ========
    package com.company.group;
      public class String2Number
          public static String Convert(String[] a)
                          double sum=0;
                          String[] temp = new String[100];
                         for(int i=0;i<a.length;i++)
                                  temp<i> = (a<i>).replaceAll("[,
    $
                                         sum=sum+Double.parseDouble(temp<i>);
                            return sum+"";
    >
    Please guide me into the right solution.
    Thanks and Regards,
    Karanam

    Thanq for your response,
    But my stylesheet is as below
    <
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.infosys.com/sap/xi/projects/sce/n1" xmlns:Trans="com.company.group.String2Number">
         <xsl:template match="/">
              <a:MT_TargetXSLJava>
                   <Record>
                        <Detailrecord>
                             <Sum>
                                  <xsl:value-of select="Trans:Convert(//Grant_Amount)"/>
                             </Sum>
                             <Flag>
                                  <xsl:value-of select="//DETAILRECORD/Grant_Amount"/>
                             </Flag>
                        </Detailrecord>
                   </Record>
              </a:MT_TargetXSLJava>
         </xsl:template>
    </xsl:stylesheet>
    >

Maybe you are looking for

  • How to get "Date" alone from the built-in field "ExecutionTime"

    Hi,    I am new to SSRS. In my report, under the report heading, I want to show just the Execution date (for example "06/15/2010" if I run the report today). I dont know how to format the "ExecutionTime" built-in field? Please help me..

  • Mass unblocking of Vendor Invoices

    Hi I posted three Vendor invoices in  FB60. These document were blocked to payment (with payment block indicator). Now i want to remove the payment block simultaneously with for all the invoices. How can i do this. FBL1N --> Environment --> Mass Chan

  • Why does Scroll in IOS 8  and Swipe conflict?

    Hi guys, Why does Scroll in IOS 8  and Swipe conflict? When I use swipe right or swipe left in EA and test it on IOS8 it works fine but if I scroll down it triggers the swipe right or left assignment ... Does anyone know a code to not have these two

  • Clients of BI Standard Edition One

    Is possible install programs of BI SE One (Warehouse Builder, BI Administration, Presentation Services, ...) in a client machine with XP attatching to server (client-server, web, ...)? I cann't work with the server (it wil be in a CPD). Only one pers

  • How to read data from different tabs of an excel sheet?

    Hello everybody: I try to read an specific sheet from excel workbook with multiple sheets, but I can't obtain any soluction. Any have a example ABAP code for the specific question? Regards, Piero Cimule Troise,