Custom Components and passing arguments

This afternoon i got a great answer regarding the use of custom MXML components and calling a function back in the main application file. I can accomplish this now by using parentDocument BUT I need to pass the name of a function(for filtering) as a parameter of the function call in the custom component. Below are the two code fragments.
Custom Component Code
<mx:LinkButton label="10% off or more" click="parentDocument.filterFunction(showTenPercent)" />
Main App Code
public function filterFunction(functionName:Function):void {
merchantDG.visible=true;
merchantData.filterFunction=functionName;
merchantData.refresh();
            public function showTenPercent(item:Object):Boolean {
                    return (item.merchantOfferCategory=="10%");
The filterFunction in the main App is called by multiple components so I believe I need to keep in centralized in the main app. There is probably another way to do this but I am building my Flex skills slowly and need to understand how to do this. As the code is now, I get an error about functions and strings.

I believe instead of calling the function from inside the custom component you need to do this from inside your main application whenever you're initiating the custom component.
for ex.
<custom:LinkBtnCustom label="10% off or more"  click="filterFunction(showTenPercent)"/>
this way you don't need the parentDocument prefix.

Similar Messages

  • I need to call a batch file from java and pass arguments to that Batch file

    Hi,
    I need to call a batch file from java and pass arguments to that Batch file.
    For example say: The batch file(test.bat) contains this command: mkdir
    I need to pass the name of the directory to the batch file as an argument from My Java program.
    Runtime.getRuntime().exec("cmd /c start test.bat");
    How to pass argument to the .bat file from Java now ?
    regards,
    Krish
    Edited by: Krish4Java on Oct 17, 2007 2:47 PM

    Hi Turing,
    I am able to pass the argument directly but unable to pass as a String.
    For example:
    Runtime.getRuntime().exec("cmd /c start test.bat sample ");
    When I pass it as a value sample, I am able to receive this value sample in the batch file. Do you know how to pass a String ?
    String s1="sample";
    Runtime.getRuntime().exec("cmd /c start test.bat s1 ");
    s1 gets passed here instead of value sample to the batch file.
    Pls let me know if you have a solution.
    Thanks,
    Krish

  • Upload file in custom program and pass it to workflow

    Hi, guys.  Now, i have the requirment to allow user to upload file in the custom program and trigger the workflow with the attached file.
    Any one has experience on this? i would like to know how to upload the file from custom program, and how to create instance of the BO "SOFM".  Then, i can pass this instance to workflow.

    HI Jrockman,
    Please check the solved reply in this thread
    Passing a file from a report  to workflow container
    Hope this would solve your issue.
    Good luck
    Narin

  • Creating pocess intance of a different process and passing arguments

    Creating Process instance of a different process:
    I have two different process: Main_Flow (id: MainFlow) and Second_Flow (id: SecondFlow). In the first process I am reading a csv file. Each line of the file has four columns. After reading each line I have to initiate Second_Flow and pass the read data from the file. (Pls find the code below for the whole process):
         fileReader = FileReader(arg1 : fullFileName);//filename is of file type and have file name and path
         Java.Io.BufferedReader reader = BufferedReader(arg1 : fileReader);
         String str;
         int countLines = 0;
         while ((str = reader.readLine()) != null)
              strColumn = str.split(delim : ",");
                   int ColumnCnt = 0;
                   while (ColumnCnt < 4)
                        //defining variables
                        String appNo;
                        String custNo;
                        String loanAmm;
                        String loanDate;
                        //logMessage("Value at Column: " + ColumnCnt + " is " + strColumn[ColumnCnt]);
                        if (ColumnCnt == 0)
                             arrLoanData["appNo"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 1)
                             arrLoanData["custNo"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 2)
                             arrLoanData["loanAmm"] = strColumn[ColumnCnt];
                        else if (ColumnCnt == 3)
                             arrLoanData["loanDate"] = strColumn[ColumnCnt];
                        arrLoanData["descriptionArg"] = "AutoInstance: " + formatTime('now', timeStyle : Time.SHORT);
                        arrLoanData["genByArg"] = "Automatic";
                        ProcessInstance.create(processId : "/SecondFlow", arguments : arrLoanData, argumentsSetName : "BeginIn");
                        ColumnCnt = ColumnCnt + 1;
              countLines = countLines + 1;     
    (“The code is in Java and not in PBL”)
    I have to pass appNo, custNo, loanAmm and loanDate as the arguments. The Argument will be of Any[String] type. The argument set name of Second_Flow is “BeginIn”. But I am not getting anything in Second_Flow.
    What can I do in the argument mapping of begin of Second_Flow to get the passed argument (array)?

    the argument 'arguments' for the method ProcessInstance.create receives a map of the arguments that the 'argumentSetName' argument set will receive.
    so for example if your second flow has 2 arguments, String name, Decimal value and String[] content your method invocation would be:
    ProcessInstance.create(processId : "/SecondFlow", arguments : {"name": strNameFromCsv, "value": valueFromCsv, "content": ["a","b","c","d"]}, argumentsSetName : "BeginIn");

  • Upgrading packages from 2005 to 2012 : Custom components and delyavalidation woes

    Hey folks
    I've two specific cases with upgrading SSIS 2005 to 2012
    1st : most annoying
    I have a custom transformation written in c# 2005. It references sql server 2005 dlls such as from 
    Microsoft.SQLServer.DTSRuntimeWrap
    Microsoft.SQLServer.ManagedDTS
    Microsoft.SqlServer.PipelineHost
    Those are stored under 
    C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
    The requirement is to upgrade the package to 2012 and the code as well. Since 2005 was not installed on new server , I copied the referenced dlls from old server , added them back to C# project and rebuilt the Custom components dlls then added to GAC
    When I open the packages , they complain about the version
    Error 2
    Validation error. : The component metadata for "My_Comonents, clsid {874F7595-FB5F-40FF-96AF-FBFF8250E3EF}" could not be upgraded to the newer version of the component. The PerformUpgrade method failed.  
    So I thought , I can add the dll to the toolbox and add it again. WHen I try this , I get this error
    "Could not load file or assembly Microsoft.SqlServer.PipelineHost  ,version = 9.0.242.0"
    Now I assume this is because I don't have 2005 components installed.
    Before getting things messy , what should be the right approach :
    a- Should I just leave the custom components dlls as they are and add them to GAC ? but they will still need 2005 dlls , should I install 2005 client components ?
    b- I can not change the code of the c# project to use new SQL 2012 components , it's a lot of work. so what should be right approach here ?
    That was the important part
    2- Validation
    Even for disabled tasks , like data flow task , setting delyavalidate= True still doesn't help against them being validated and raising error. removing them will help but I do not want , any workaround ?
    Thanks

    Thanks a lot Joost , appreciate the feedback
    This is what I thought too.
    I came to the blog you mentioned , but I wasn't sure how it should be related to my problem. Now I think I'll need to make the code changes.
    Indeed , I see some declarations of *****90
    public void CreateExternalMetaDataColumn(IDTSOutput90 output, int outputColumnID)
                IDTSOutputColumn90 oColumn = output.OutputColumnCollection.GetObjectByID(outputColumnID);
                IDTSExternalMetadataColumn90 eColumn = output.ExternalMetadataColumnCollection.New();
        public override DTSValidationStatus Validate() {
                IDTSVariables90 variables = null;
    public override void SetOutputColumnDataTypeProperties(int outputID, int outputColumnID, Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType dataType, int length, int precision, int scale, int codePage) {
                IDTSOutputCollection90 outputColl = this.ComponentMetaData.OutputCollection;
                IDTSOutput90 output = outputColl.GetObjectByID(outputID);
                IDTSOutputColumnCollection90 columnColl = output.OutputColumnCollection;
                IDTSOutputColumn90 column = columnColl.GetObjectByID(outputColumnID);
    SO I should use 2012 references and start migrating this code over ? is it as easy as so ?
    Thanks

  • CF FDS and passing argument

    I need to pass an argument with the dataservice fill to the
    CFC (assembler to dao) so I can build the query correctly.
    I could not find the document on Adobe site for the CF. Can
    some one give me the url for the document or help me out.
    So, the examples is :
    ds.fill(myDS, 'argument')?
    and what is CFC looking on the other hand.
    Thx

    Have you read this article or looked at the associated code
    (made available as a zip file)?
    http://www.adobe.com/devnet/flex/articles/coldfusionflex_part1.html

  • Custom Components and Properties in Flex Builder Design View

    How do I create a custom component with custom properties
    that renders well in Flex Builder design view?
    This is a simple HelloWorld example of what I am trying
    below. Here is the HelloWorld.mxml file:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="500" height="500">
    <mx:Script><![CDATA[
    [Bindable]
    public var message:String;
    ]]></mx:Script>
    <mx:Label x="100" y="100" text="{message}" />
    </mx:Canvas>
    And then when I use it in another mxml file, the design view
    does not show the label with the 'Hello World' value - instead it
    just shows {message} in design view where the label is located.
    When I run it as a compiled app in flash, the 'Hello World' is
    displayed correctly:
    -- HelloWorldTest.mxml --
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:views="mypackage.*" width="500" height="500">
    <views:SimpleLine message="Hello World."/>
    </mx:Canvas>

    design view does not do any variable assignments or function
    evaluations, so you won't be able to see it even if you don't use a
    custom component.

  • Quick question about custom Components and Panels

    Okay, so here is the situation.
    I created a custom component that overrides paintComponent. All this component does is draw a diagonal line.
    If I add this component directly to a JFrame it displays fine.
    The issue: I made a custom JPanel that at the moment only contains this component. If I add it to the JPanel then add that to the JFrame, it only displays a dot.
    Any suggestions?

    Layout issue. The intermediate JPanel has a default FlowLayout manager which shows its child components at their preferredSizes. These sizes are computed by the layout manager in the process of laying out the children. When there are no children the size reported to the parent is the default size which for JPanel is (10, 10). You can change the layout manager for the intermediate panel or specify a preferredSize for the graphic component in one of two ways:
    1 - use the setPreferreSize method
    2 override the getPreferredSize method in the class:
    class Pseudo extends Jpanel {
        protected void paintComponent(Graphics g) {
            // custom drawing...
        public Dimension getPreferredSize() {
            return new Dimension(desiredWidth, height);
    }

  • Custom components and binding ... help !!

    hi, i have created a component that wraps the TextInput
    control with its own set and get text methods, but it does not work
    well with the Binding mechanism.
    here is the code:
    <vc:myTextInput text="{str}" y="8" tabIndex="0" x="100"
    id="in1"/>
    and the binding
    <mx:Binding source="in1.text" destination="str"/>
    does not update the str field.
    can any one tell me what i did wrong / forgot to add ??
    cheers,
    Jaimon

    hi as ntsii said i am looking for a two way binding meaning
    that for every change in either of the controls, will be seen by
    the other...
    i am guessing that in order that the custom component work
    with the binding mechansim a certain API must be implemented of a
    mechanism that dispaches the right event ... but i could not find
    any ducomentation
    any help would be blessed ... happy new year
    Jaimon

  • Custom components and the navigator object

    Hi all,
    I'm starting on a mobile project which is a ViewNavigator based application. I've created a custom component which contains a button. I'd like the button to be able to use the pushView method however as it's a custom component, it doesn't appear to recognise the navigator object. If anyone has any advice/tips on how I might go about this, it'd be greatly appreciated!

    The button sits in a custom component - actually in a datarenderer. Code looks like:
    <?xml version="1.0" encoding="utf-8"?>
    <s:DataRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                            xmlns:s="library://ns.adobe.com/flex/spark">
      <fx:Script>
                        <![CDATA[
                                  import mx.utils.ObjectUtil;
                                  protected function button1_clickHandler(event:MouseEvent):void
                        ]]>
      </fx:Script>
      <fx:Declarations>
      </fx:Declarations>
              <s:Button label="{data.firstName}" click="button1_clickHandler(event)" width="150" height="150" />
    </s:DataRenderer>
    which is being called from a View. There's no error, I'm simply unable to/unsure how to access the navigator object so I can push a new view onto the stack from within that component.
    Cheers!

  • Passing arguments

    Our teacher just taught us about methods and passing arguments, etc. I have been over our text book and I don't quite understand how it works. Any help?
    PROBLEM:
    ?     Write a program with four methods. One is the main method. The other three are named startMessage, message, and finishMessage.
    ?     Within the startMessage method, place code to print out the message ?The program has started.?
    ?     Within the message method, place code to print out any message that is passed, as a String, into the method using a String parameter named output.
    ?     Within the finishMessage method, place code to print out the message ?The program is done.?
    ?     When the program begins call the startMessage method.
    ?     Then display the following dialog box:
    "Enter a message:"
    ?     Using a While loop, respond to the user?s input appropriately:
         If the user presses OK display whatever the user has entered by calling the message method with the user?s input as the argument. Continue to display the dialog box and display the user?s input until they press Cancel.
         When the user presses Cancel stop showing the dialog box, and do not display what the user has entered.
    ?     After the user presses Cancel, and before the program terminates, call the finishMessage method.
    ?     Terminate the program.
    here is what I have so far:
    public static void main(String[] args) {
              startMessage();
              String userMessage = JOptionPane.showInputDialog("Enter a message:");
              while (userMessage != null){
                   message(userMessage);
                   JOptionPane.showMessageDialog(null, "Here is message" + message());
                   userMessage = JOptionPane.showInputDialog("Enter a message:");
              finishMessage();
              System.exit(0);
         public static void startMessage(){
              JOptionPane.showMessageDialog(null, "The program has started.");
         public static String message (String output){
              output = userMessage;
              return(output);
         public static void finishMessage(){
              JOptionPane.showMessageDialog(null, "The program is done.");
    }what's giving me the problem is the message method; I can't figure out how to pass whatever they put in the userMessage variable to the message method

    I am stuck here
    PROBLEM:
    ?     Change your C6E2 class by adding a new method called getNumberInput. This method will be used to get a number input from the user, replacing the lines of code in the main method that were previously used. You will need to call this method twice from the main method, prompting for the first and second numbers in turn.
    ?     Write the method so that the prompt displayed in the input dialog box is passed through an argument.
    ?     The return type of this new method will be a double.
    I can't figure out how to pass the input paramater correctly, any help?
    public static void main(String[] args) {
              double num1 = 0;
              double num2 = 0;
              double addResult = 0;
              double subtractResult = 0;
              double multiplyResult = 0;
              double divideResult = 0;
              double input1 = getNumberInput(num1);//this is where I am stuck
              double input2 = getNumberInput(num2);
              addResult = add(num1, num2);
              subtractResult = subtract(num1, num2);
              multiplyResult = multiply(num1, num2);
              divideResult = divide(num1, num2);
              JOptionPane.showMessageDialog(null, addResult);
              JOptionPane.showMessageDialog(null, subtractResult);
              JOptionPane.showMessageDialog(null, multiplyResult);
              JOptionPane.showMessageDialog(null, divideResult);
              System.exit(0);
         }//main
         public static double getNumberInput (double input){
              double output = 0;
              Double.parseDouble(JOptionPane.showInputDialog("Enter a number:"));
              return output;
         public static double add (double term1, double term2){
              double result = term1 + term2;
              return result;
         }//add
         public static double subtract (double term1, double term2){
              double result = term1 - term2;
              return result;
         }//subtract
         public static double multiply (double term1, double term2){
              double result = term1 * term2;
              return result;
         }//multiply
         public static double divide (double term1, double term2){
              double result = term1 / term2;
              return result;
         }//divide
    }//class

  • Building JSF 1.2 Custom Components with EL and standard components

    Hi all,
    I have built custom components in jsf 1.1 with great success but i am finding replicating the same functionality in jsf 1.2 very difficult. I have some conditions for my new custom component.
    - Using jsf 1.2
    - Must use unified EL, i am using a UIComponentELTag
    - iam using jsf standard html components from javax.faces.component.html here in particular i wont HtmlCommandLink.
    Essentially i am constructing a real time command menu. I have a backing bean from which i get command names and descriptions values. I wont to then in real time construct a table of links (using HtmlCommandLink) - all this work is to be processed by a custom component. Basically the commandLink issues a command in my backing bean, a parameter (param) is passed with the commandLink, this is later picked up in the backing bean method.
    I can generate the table, and all the HtmlCommandLinks, i have simply looped throught and encoded each of them.
    What i can do: i can see the table and the HtmlCommandLinks, but the links dont perform any action when i press them.
    What i want help with:
    I want to encode a HtmlCommandLink in my custom component with a param, traditionally i would set the action but this is now deprecated, and i need to use the setActionExpression method. I have tried to do this but the actions are note fired its simply doesnt function.
    Note:
    In jsf 1.1 I use to loop through all the HtmlCommandLink and peform their processDecodes method within my custom components very own processDecodes. The same in jsf 1.2 doesnt seem to yield any results.
    Can someone give be an example or solution to this? I have read articles on the net and they seem to all discuss jsf 1.1 which i have done and it works, but i am using unifed EL and jsf 1.2 now.
    Many Thanks,
    Kev

    Hi all,
    I have built custom components in jsf 1.1 with great success but i am finding replicating the same functionality in jsf 1.2 very difficult. I have some conditions for my new custom component.
    - Using jsf 1.2
    - Must use unified EL, i am using a UIComponentELTag
    - iam using jsf standard html components from javax.faces.component.html here in particular i wont HtmlCommandLink.
    Essentially i am constructing a real time command menu. I have a backing bean from which i get command names and descriptions values. I wont to then in real time construct a table of links (using HtmlCommandLink) - all this work is to be processed by a custom component. Basically the commandLink issues a command in my backing bean, a parameter (param) is passed with the commandLink, this is later picked up in the backing bean method.
    I can generate the table, and all the HtmlCommandLinks, i have simply looped throught and encoded each of them.
    What i can do: i can see the table and the HtmlCommandLinks, but the links dont perform any action when i press them.
    What i want help with:
    I want to encode a HtmlCommandLink in my custom component with a param, traditionally i would set the action but this is now deprecated, and i need to use the setActionExpression method. I have tried to do this but the actions are note fired its simply doesnt function.
    Note:
    In jsf 1.1 I use to loop through all the HtmlCommandLink and peform their processDecodes method within my custom components very own processDecodes. The same in jsf 1.2 doesnt seem to yield any results.
    Can someone give be an example or solution to this? I have read articles on the net and they seem to all discuss jsf 1.1 which i have done and it works, but i am using unifed EL and jsf 1.2 now.
    Many Thanks,
    Kev

  • Passing arguments to a custom component in the constructor

    I would like to know if it is possible to pass arguments to a
    custom component in the constructor when I'm instantiating it
    within Actionscript. I've not seen anyone do this, so at the moment
    I have a couple of public properties defined on the custom
    component and then do the following:
    var myComponent:TestComponent = new TestComponent();
    myComponent.propertyOne = true;
    myComponent.propertyTwo = 12;
    etc.
    Whereas I'd like to do something like:
    var myComponent:TestComponent = new TestComponent( true, 12
    Any ideas if this is possible?

    Another approach as opposed to creating init function is to link symbol with autogenerated class (just assign it a class but do not create *.as file for it) and use it just as graphical view with no functionality (well only MovieClip's functionality).
    ViewClip.as
    public class ViewClip extends MovieClip {
        public var view:MovieClip;
        public function ViewClip(){
            this.view = instantiateView();
            this.addChild(view);
        protected function instantiateView():MovieClip {
            return new MovieClip();
    Circle.as
    public class Circle extends ViewClip {
        public function Circle(scaleX:Number, scaleY:Number) {
            super();
        override protected function instantiateView():MovieClip {
            return new ClassView();

  • Get current customer in CIC and pass it to BSP

    Hi experts,
    I'm new to the CIC application but very familiar with CRM Web Client.
    The customer embedded a z-BSP into it's business role to call a SAP GUI transaction in a new window. This works.
    Now, the current customer, which is selected in interaction center shall be passed to the BSP so that the SAP GUI transaction can be started with this customer id.
    Can anyone tell me how to get this customer object from CIC and pass it to the BSP?
    Thank you very much!
    BR
    Mireille

    Hi Mirelle,
    As stated by Peter correctly, the confirmed data (e.g current customer) data is present in the buffer at the global data context level. You can fetch it using the below sample code too:
    DATA : lr_gdc TYPE REF TO if_crm_ui_data_context,
                 lr_cust TYPE REF TO if_bol_bo_property_access.
      lr_gdc = cl_crm_ui_data_context_srv=>get_instance( ).
      CHECK lr_gdc IS BOUND.
      lr_cust  =   lr_gdc->get_entity( name = if_iccmp_global_data_cont_con=>gdc_currentcustomer ).
    I hope this helps. Please let me know if you have any questions.
    Thanks
    Vishal

  • Workflow step (Approve Action) calling custom Java Service and "passing params"

    Good Afternoon, Fellow Coders!
    Normally I research and do proof of concepts until I find a solution but given super tight deadlines, I just don't have time - so I need your help.
    I am trying to have an Workflow Approve Action (Workflow Exit Event idocScript call) call a Custom Component (Java Service) AND "pass" some kind of parameters (bare minimum dDocName)
    In a perfect world it would be as simple as:    processContentInfo(String dDocName, String xMyCode1, String xMyCode2);
    But since I am calling the Java Service from idocScript (via executeService) I cannot directly pass params via the API.
    Is there a simple way to do this??
    It seems like if you can't directly pass params you could at least set them in the managed container (m_binder) and just know to pick them up on the Java side via some DataBinder like m_binder.getLocal(
    Am I missing a simple idocScript function that will let you do this?
    Note: I am NOT executing the Service from a URL so the normal ?param1&param2 -> m_binder.getLocal  solution is no good.
    Also, Bex's book warns about Service Classes "not easily being able to call other UCM Services"....  My Custom Service needs to do exactly that (as well as JDBC and other stuff). Is this really an issue??
    Seems like as long as I have dDocName I could use RIDC to hit whatever I want as long as I know how to use a binder, etc - is there some mystic nuance that prevents this?  Or was he just saying it's hard UNLESS you know RIDC well??
    Any and all quality advice is appreciated!  And please, try to give me a detailed answer as opposed to something vague like "try a Service Handler", I need something I can quickly digest.
    Thanks in advance!

    You can set parameters for the service call by setting Idoc Script variables before you call executeService.
    <$dDocName="TEST12345"$>
    <$param1="09876"$>
    <$param2="ABCDEFG"$>
    These variables are then available via the service DataBinder.
    Here is information about how to execute a service from a custom component. There should not be any issues doing this.
    http://www.redstonecontentsolutions.com/5/post/2012/05/executing-a-service-from-aservicehandler.html
    http://jonathanhult.com/blog/2012/06/execute-a-service-from-a-java-filter/
    Jonathan
    http://jonathanhult.com

Maybe you are looking for

  • Help Me Choose A Dock

    I have to choose between two docks- the Ipod Universal Dock, or the Ipod Nano dock. I know that you can do more with your ipod with the universal dock, but is the Nano dock more simple to use? Tell me what you recommend.

  • Dymo labels javascript (API) issue

    Hi all. APEX 4.2 11gR2 XE database. I'm trying to print labels directly from APEX via a JS library from DYMO (DYMO label framework for javascript). I would like to fetch the XML for the label layout dynamically from the database instead of fixed assi

  • Out of Memory Error in TOAD....

    Hi Guys, I am trying to export my result set in TOAD to a .CSV format(on my local drive). The export goes well till a certain point but then after say like exporting 1.8 million rows it throws the error: "TOAD out of memory". Please suggest a workaro

  • SDDM EA 3.1: Engineer to Relational Model (subtypes)

    It seems that mandatory attributes of entity subtypes become mandatory columns on the corresponding tables even when you engineer to "one table" (the super type). In that case I would expect that the column would become optional. Even better: a check

  • Batch monitor will not open.....

    wont open