How do I create a dynamic 2xN array?

Hey All,
I've got a question that seems pretty easy in concept but for some reason I just can't quite figure it out. All I want to do is run through a matrix using for loops and if a value in that matrix is equal to the value I set (my cutoff value), I take the coordinates (the iterations of the loops) and pop them into an array, which I hope to use as a set of graphable points. So I start out by building a 2x1 1D array from the two points I get (my loop iterations again, which would represent my X and Y values), by using the Build Array VI. Now I try feeding that into another Build Array VI that has a feedback loop on it which feeds back into itself. The output from this is then sent to an Array Size VI (which is outside the loops) so that I can see just how big my 2xN array got.
Now the good news is that I do get a 2D array as an output. The bad news is that try to get the data exactly when my cut off point occurs (ie. if(data == cutoff) ) I get no size, but if I created a range of even one lower (ie. if( (data <= cutoff) || (data >= (cutoff-1))) ) then the size of my array turn out to be 2x49152, which is the total range of my data (192*256). Now I know for a fact that not every point in my data is one less than my cutoff point (which is the maximum value in this case) as I have a meshing that shows me the values. I also thought that maybe conflicting data types might be a problem, so I converted my cutoff value from a int to a float type. No dice there either. Soooo, I figure it must be some underlying logic that I'm missing or something that LabView does differently than I expect.
I guess my actual question is this then: Why does LabView gives me either a 0 element array or a complete array (as in ALL the data points not just the ones at the cutoff value)? Also if there is a better way to build the array than this.
I have attached a picture of my current set up that retrieves the data points, builds the 2xN array and gets the size. If there's any other part that you may need to see, just let me know.
Thanks,
Phil
[url=http://img114.imageshack.us/my.php?image=buildinganarrayjl7.jpg][img=http://img114.imageshack.us/img114/3226/buildinganarrayjl7.th.jpg][/url]
P.S. Here's an direct link to the image if the above doesn't work: http://img114.imageshack.us/img114/3226/buildinganarrayjl7.jpg

If I understood you correctly, you want to find the indices where the array element value matches a certain fixed value. One thing you must understand is that you must never perform equality operations on floating point values with computers. Computers operate in base 2, while you operate in base 10. It is not possible to precisely represent a floating point number using computers. This issue comes up a lot. How you choose to do the comparison depends on your numbers and what level of precision you want.
That said there is no need to use a formula node for simple arithmetic. LabVIEW has functions to do that, and they're much faster than using a formula node. Don't try to write LabVIEW code using text-programming techniques. It won't work. I don't use Feedback Nodes because I hate them. I prefer shift registers since they're much easier to understand, and you can't accidentally flip their direction. Here's a simple implementation using shift registers. That little white plus function is a custom function to check if a floating point value is approximately equal to some value, within a specifed number of decimal places.
Message Edited by smercurio_fc on 08-12-2008 04:59 PM
Attachments:
Example_VI.png ‏10 KB

Similar Messages

  • Creating a dynamic Integer Array

    Hi there.
    This may seem trivial, but how do I create a dynamic array to store integers?
    I tried Integer integerArray [] = new Integer (); but i get Cannot Resolve Symbol Error.
    I am using Java 1.4.2 version.
    Any suggestions would be helpful. Thanks

    Doesnt an ArrayList store values as
    String? Even if i did use Integer.parseInt to cast to
    Integer from String doesnt it become tricky if i have
    to do much calculations?Hi,
    An ArrrayList can store any object you wish not just String. All you need to specify when retrieving an object is the type of object you want.
    For example, if you have an ArrayList of integers an you want to retrieve an integer from the list you would use:-
    int myInt = (int)myArrayList.get(myIndex);Therefore if you want to store an arbitrary object foo in an ArrayList the code is thus:-
    //replace foo with the object you are storing.
    foo foobar = (foo)myArrayList.get(myIndex);There is a slight change with ArrayLists in Java 5 where you should declare the objects that should be stored in the list but hopefully the above helps you to understand that an ArrayList or any other Collection as it happens can store objects of your choosing.
    Regards,
    Chris

  • How can I create a variable size array?

    How can I create a variable size array?

    ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
    After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
    Anyway, the answer to your question is, of course:
    Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)

  • I need to know how I will create a dynamic website using php and mysql

    I need to know how will I create a dynamic website using php and mysql that people could have the abilities of registering in the website, and modify their profile where they can add their pictures and everything. apart from that, they should have the ability to search about other member. hope to here more from you.

    If you are a right-brained creative, and have no previous experience or propensity to be able to understand coding and database "stuff", and/or if your time can be better spent on other skills, I recommend you save your sanity and hire a developer... or at least the first time around. I have been attempting to grasp this for years... and have a library of marked up books to prove my efforts, all while trying to keep up with an ongoing client base that is always cramped. It's a wonder I still have my sanity... then again, I might not be the best person to determine that. Others might question it.
    That said, I still plan to master php... one of these days.

  • How can i create a dynamic structure based on my input from a select-option

    Hello,
    This is to develop a custom report in FI for G/L Balance based on company code.
    I have an input select-option for Company code.
    Based on the range of company code my output layout should be modified.
    I am not very much sure to create a dynamic internal based on the input from a select-option.
    Can any one please let me know how can i do this.
    I would appreciate for anyone who turns up quickly.
    Thank you,
    With regs,
    Anitha Joss.

    See the following program, it builds a dynamic internal table based on the company codes from the select option. 
    report zrich_0001 .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    data: it001 type table of t001 with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_bukrs for it001-bukrs.
    selection-screen end of block b1.
    start-of-selection.
      select * into table it001 from t001
                     where bukrs in s_bukrs.
      perform build_dyn_itab.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = 'PERIOD' .
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
      loop at it001.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = it001-bukrs .
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        append wa_it_fldcat to it_fldcat .
      endloop.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Regards,
    Rich Heilman

  • How can I create classes dynamically?

    Guys
    My requirment is I want to create classes and their instancess too dynamically. First is it possible in Java?
    If so, then my next question is how can I refer such dynamically created classes in my code to avoid compilation error.
    Thanks in advance
    Regards
    Sunil

    For other ways to generate classes on runtime you could also have a look at BCEL:
    http://jakarta.apache.org/bcel
    And dynamic proxies:
    http://java.sun.com/j2se/1.4.2/docs/guide/reflection/proxy.html
    If so, then my next question is how can I refer such
    dynamically created classes in my code to avoid compilation
    error.Generally the classes that you load should either implement some interface or extend some abstract class you know of at compile time so that the compiler knows what methods are available for use. If that's not possible you can only use reflection.

  • How do you create a 2-d array%3F

    How do you create and write a 2-d array??  I have two operations in the same WHILE loop.  Each execution of the loop should generate a new  pair of values.  
    However, the BUILD ARRAY function only outputs a 1-d array to the WRITE TO SPREADSHEET FILE.vi. 
    Perhaps, more broadly, how does one put data into a 2-d array as it is collected?  I think I am building two arrays simultaneously below, but, what I really want is to build a single 2-d array.  Is this how you would do it?  It looks clumsy connecting sequential BUILD ARRAY's together.  Is this creating a 2-d array that I can search later by index and return the paired data? 
    Lastly, why does my front panel indicator only show data in the first column??  How do I make it display the data as it is collected across the rows?
    Thanks,
    Dave
    Solved!
    Go to Solution.
    Attachments:
    forum dec 12_2012 build 2d array.vi ‏13 KB

    dav2010 wrote:
    Sorry, very simple minded here...how do pairs go as a 1-d array?  I thought that (x,y) data must be a 2-d array...a column of "x's" and a column of "y's"?  Wouldn't a 1-d array just be all x's?  I admit I'm pretty new to understanding arrays.
    " build your 1D array from both scalars"  -->  how do you do this??  I cannot find a "convert to scalar" on the pallette.
    Also, here is the vi saved down to 2009, I think.
    Dave
    Here's a simpler way, just write out your X and Y as a 1D array each iteration. The Write will append your data as a column of X's and a column of Y's:
    or generate all your values and then write once:
    (fix the broken wire).
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx

  • How do I create a Dynamic PDF in ColdFusion

    I am using ColdFusion CS4 and I need to create a dynamic PDF certificate for the user when they finish a short test.
    Their name is in a session var and should dynamically enter in to the Name field of the certificate as well as the date.
    The user can print The PDF certificate, which must be protected to Allow Print only.
    I have a PDF created in Adobe Lifecycle Designer. This contains all the data and a text field Name and Data that needs the dynamic input from ColdFusion.
    <cfpdfform action="populate" source="certificate.pdf">
          <cfpdfsubform name="form1">
                <cfpdfsubform name="page1">
                      <cfpdfformparam name="employeeName" value="John Hollings" />
                      <cfpdfformparam name="date" value="#dateformat(now(), 'dd mmmm, yyyy')#" />
                      <cfpdfformparam name="submitURL" value="#CGI.SCRIPT_NAME#" />
                      </cfpdfsubform>
          </cfpdfsubform>
    </cfpdfform>
    Thsi work but the PDF textFields are open to edit, I need to lock down the PDF so only printing can operate...
    No Copy of data
    No Saving the file (if possible)
    Only print and close

    act332 wrote:
    If I make a form in Adobe Pro9 it opens Lifecycle and I am back there.
    Unfortunately, I am not using Acrobat 9/LiveCycle. So I cannot really provide any specifics there. For usage questions, you might try asking on the Acrobat/LiveCycle forums.   But from CF's perspective, the key is the form's _format_.  Acrobat (AcroForms) and LiveCycle forms are two totally different formats internally.  (Like MS Office 2007 files versus MS Office 2003 files). To flatten a form from CF, it must be an AcroForm:
    http://www.planetpdf.com/article.asp?ContentID=adobe_live_cycle_designer_and_acrobat_pdf_f orms_under_the_hood&page=1
    act332 wrote:
    I am trying to allow a user to print a document (certificate) with their name and date dynamically inserted, this document
    Well as I mentioned, you can use cfpdf or ddx to set whatever permissions you need. The default is "All" (ie all actions are allowed) but you can restrict the permissions by passing in a list of which permissions _should_ be allowed. Anything not included in the list will be restricted.
    <cfpdf permissions="None" ...>   OR
    <cfpdf permissions="AllowPrinting" ...>  OR
    <cfpdf permissions="AllowPrinting,AllowCopy" ...>  OR

  • How do I create a Dynamic java.sql.Date ArrayList or Collection?

    I Have a MySQL table with a Datetime field with many values inserted.
    I want to know which is the Best way to capture all the Inserted DB values inside a Dynamic Array.
    I get errors that state that I should use Matching data-types, and plus I don't know how to create or fill a Dynamic Date ArrayList/Collection.
    Please Help, I need this urgently...

    package pruebadedates;
    import java.sql.*;
    * @author J?s?
    public class ClaseDeDates {
        /** Creates a new instance of ClaseDeDates */
         * @param args the command line arguments
        public static void main(String[] args) {
            java.sql.Date aDate[] = null;       
            Connection con = null;
            Statement stmt = null;
            ResultSet rs = null;
            try{
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                con = DriverManager.getConnection("jdbc:mysql://localhost/pruebafechas", "root", "picardias");
                    if(!con.isClosed()){
                    stmt = con.createStatement();
                    stmt.executeQuery ("SELECT dates FROM datestable");
                    rs = stmt.getResultSet();
                        while (rs.next())
                        aDate[] = rs.getDate("dates");
            catch(Exception e)
               System.out.println(e);
            //System.out.println(aDate);     
    }Hi, There is my code and the errors that I get are:
    found : java.sql.Date
    required: java.sql.Date[]
    aDate = rs.getDate("dates");
    Actually I have No idea as How to get a Result set into an ArrayList or Collection. Please tell me how to do this Dynamically. I have like 25 records in that Database table, but they will grow, so I would really appreciate to know the code to do this. I suspect my problem is in the bolded part of my code.
    Thank you very much Sir.

  • How can I create events dynamic for a Group/List?

    Hey,
    atm I'm programming a little application where i want to add elements to my center-pane.
    Simpyfied I got:
    - Center Pane : here shall the elements appear on right click in bottom-pane. This pane shall be used as anything like a playground where you can drag/drop and connect items from the bottom-pane
    - Bottom Pane: here I got about 180 elements which are quite equal. This is sth like a menu of items which you can use. I realised them in java classes extended from a parent class with differend calulations.
    What I want:
    I want to create an event handler for EACH of the "menu" elements dynamically. Just sth like:
        for (int i = 0; i < basic_menu_list.size(); i++)
          final Element el = hbox_bottom.getChildren().get(i);
          hbox_bottom.getChildren().get(i).setOnMouseClicked(new EventHandler<MouseEvent>()
            public void handle(MouseEvent event)
              if (event.isSecondaryButtonDown())
                playground.add(el);
                redrawPlayground();
        }But as i expected this doesnt work...
    Now my question:
    How can I solve this problem? Is there any option to listen to all elements of a group without hard-coding every single listener?
    Thanks for your help,
    Martin

    Hello User,
    Why did you expect that it wouldn't work?
    You have an example with "transition" apply on a bunch of circles in the Getting Started with JavaFx (http://download.oracle.com/javafx/2.0/get_started/jfxpub-get_started.htm)
    Here a basic example class...
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.TextBox;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.Pane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class HelloWorld extends Application {
        //~ ----------------------------------------------------------------------------------------------------------------
        //~ Methods
        //~ ----------------------------------------------------------------------------------------------------------------
        public static void main(String[] args) {
            // Entry point
            Application.launch(args);
        @Override
        public void start(Stage mainStage) throws Exception {
            Pane pane = new Pane();
            Scene scene = new Scene(pane, 200, 200);
            VBox vBox = new VBox();
            TextBox input1 = new TextBox();
            TextBox input2 = new TextBox();
            vBox.getChildren().addAll(input1, input2);
            for (Node input : vBox.getChildren()) {
                input.setOnMouseClicked(new EventHandler<MouseEvent>() {
                        public void handle(MouseEvent event) {
                            System.out.println("test click");
            pane.getChildren().add(vBox);
            mainStage.setScene(scene);
            mainStage.setVisible(true);
    }Niculaiu

  • How can I create a dynamic Dropdownlist

    Hi Experts,
    I am new in the adobe forms and I have this problem.
    I am working on a Dropdownlist in Adobe Interactive Form. In my case, my form will be used in Offline-ABAP system without any web dynpro application.
    I have an internal table containing some values like this (number of rows depend on what is store on the database dynamic)
    A0  Dropdownlist1
    A1    Dropdownlist2
    A2    Dropdownlist2
    B0 Dropdownlist1
    B1    Dropdownlist2
    B2    Dropdownlist2
    B3    Dropdownlist2
    B4    Dropdownlist2
    C0  Dropdownlist1
    C5    Dropdownlist2
    C6    Dropdownlist2
    C7    Dropdownlist2
    I would like to create 2 dropdownlist. to be as follows:
    The first dropdownlist must have for example the values A0, B0, C0 .
    When the user select for example B0 from the Dropdownlist1, then dropdownlist2 must have only the value B1, B2, B3 and B4.
    How can i do that as I have seen the example in the purchase order (country and state).
    My requirement is that, the value must be dynamic, that means i must select the value from the SAP-Database into internal table and bind it to my dropdownlist.
    Thanks and Regards.
    mishak

    See the following program, it builds a dynamic internal table based on the company codes from the select option. 
    report zrich_0001 .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    data: it001 type table of t001 with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_bukrs for it001-bukrs.
    selection-screen end of block b1.
    start-of-selection.
      select * into table it001 from t001
                     where bukrs in s_bukrs.
      perform build_dyn_itab.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = 'PERIOD' .
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
      loop at it001.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = it001-bukrs .
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        append wa_it_fldcat to it_fldcat .
      endloop.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Regards,
    Rich Heilman

  • How do I create continuous dynamic fields in Acrobat Pro?

    Hello everyone,
    I've created a legal PDF file and I need to add some dynamic fields inside.
    I know how to make the fields but I would like to make it so that if there are more than one on the same line, that they will affect each other's length in case the user inputs long / short data.
    For example:
    If I have 2 fields:
    NAME          SURNAME
    How do I make it that after the user inputs their NAME the SURNAME field will start a bit after the NAME field and there will be no big gap between them.
    Looking forward to hear some solutions
    Thanks.

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • How can I creat a dynamic chart legend?

    Will,I want to show multi hosts' dynamic CPU performance (the host ip can be changed).I use those code below for a test:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" backgroundColor="0xFFFFFF" initialize="init()">
         <mx:Script>
              <![CDATA[
                   import mx.charts.ChartItem;
                   import mx.charts.chartClasses.IAxis;
                   import mx.charts.chartClasses.LegendData;
                   import mx.charts.chartClasses.Series;
                   import mx.charts.events.ChartItemEvent;
                   import mx.charts.series.LineSeries;
                   import mx.collections.ArrayCollection;
                   import mx.containers.Canvas;
                   import mx.containers.HBox;
                   import mx.controls.Alert;
                   import mx.graphics.SolidColor;
                   [Bindable]
                   private var dayTimeV:int = 0;
                   [Bindable]
                   private var legendDP:ArrayCollection = new ArrayCollection();
                   //for record whether the ip changed by using the length
                   private var latestIp2Length:Object = new Object();
                   [Bindable]
                   public var statsPpg:ArrayCollection = new ArrayCollection([
                        new ArrayCollection([{dayTime:dayTimeV,CPU:24.0, IP:"100.0.2.0"}]),
                        new ArrayCollection([{dayTime:dayTimeV,CPU:27.6, IP:"100.0.2.1"}]),
                        new ArrayCollection([{dayTime:dayTimeV,CPU:35.4, IP:"100.0.2.2"}]),
                        new ArrayCollection([{dayTime:dayTimeV,CPU:31.6, IP:"100.0.2.4"}]),
                        new ArrayCollection([{dayTime:dayTimeV,CPU:28.3, IP:"100.0.1.6"}]),
                        new ArrayCollection([{dayTime:dayTimeV,CPU:27.2, IP:"100.0.1.9"}])
                   private function init():void{
                        latestIp2Length["100.0.2.0"] = 1;
                        latestIp2Length['100.0.2.1'] = 1;
                        latestIp2Length['100.0.2.2'] = 1;
                        latestIp2Length['100.0.2.4'] = 1;
                        latestIp2Length['100.0.1.6'] = 1;
                        latestIp2Length['100.0.1.9'] = 1;
                        initLegend();
                        createLineSeries();
                   private function createLineSeries():void{
                        for(var i:int = 0 ;i < statsPpg.length ;i++){
                        var lineSeries:LineSeries = new LineSeries();    
                        lineSeries.yField = "CPU";    
                        lineSeries.displayName = "CPU";
                        lineSeries.dataProvider = statsPpg[i];
                        lineSeries.id = "lineSeries"+i;
                        lineSeries.setStyle("adjustedRadius",2);
                        lineSeries.setStyle("radius",40);
                        lineSeries.setStyle("fill","#55CC33");
                        var series:Array = chartPPG.series;
                        series.push(lineSeries);
                        chartPPG.series = series;
                   //find the record using ip
                   private function indexOf(ip:String):int{
                        for(var i:int = 0 ; i < statsPpg.length ;i++){
                        if(statsPpg[i].getItemAt(0).IP == ip)
                             return i;
                        return -1;
                   private function modifyData():void{
                        dayTimeV++;
                        //all new added data
                        var forAdded:ArrayCollection = new ArrayCollection([
                             {dayTime:dayTimeV,CPU:24.0+Math.random()*10, IP:"100.0.2."+dayTimeV},
                             {dayTime:dayTimeV,CPU:27.6+Math.random()*10, IP:"100.0.2."+(dayTimeV+1)},
                             {dayTime:dayTimeV,CPU:35.4+Math.random()*10, IP:"100.0.2."+(dayTimeV+2)},
                             {dayTime:dayTimeV,CPU:31.6+Math.random()*10, IP:"100.0.2."+(dayTimeV+3)},
                             {dayTime:dayTimeV,CPU:28.3+Math.random()*10, IP:"100.0.1."+(dayTimeV+4)},
                             {dayTime:dayTimeV,CPU:27.2+Math.random()*10, IP:"100.0.1."+(dayTimeV+5)}
                        //the data(IP) appear at first time
                        var waitedForAdded:ArrayCollection = new ArrayCollection();
                        for(var i:int = 0 ; i < forAdded.length ;i++){
                             var index:int = indexOf(forAdded[i].IP);
                             if(index != -1){//if we found,append it
                                  statsPpg[index].addItem(forAdded[i]);
                             }else{//if not,
                                  waitedForAdded.addItem(forAdded[i]);
                   var j:int = 0;
                    for(i = 0 ; i < statsPpg.length ;i++){
                         // if length not changed,delete old data and add new
                         if(latestIp2Length[statsPpg[i][0].IP] == statsPpg[i].length){
                              delete latestIp2Length[statsPpg[i][0].IP];
                              var legendIndex:int = findLegendDPData(statsPpg[i][0].IP);
                              statsPpg[i].setItemAt(waitedForAdded[j],0);
                              latestIp2Length[waitedForAdded[j].IP] = statsPpg[i].length;
                              legendDP.setItemAt(newLegendData(waitedForAdded[j].IP),legendIndex);
                              j++;     
                         }else{//if length changed,the data appended already
                              latestIp2Length[statsPpg[i][0].IP] = statsPpg[i].length;
                   private function addData():void{
                        dayTimeV++;
                        newData();
                   private function newLegendData(ip:String):LegendData{
                        var legendData:LegendData = new LegendData();
                        legendData.label= ip;
                        legendData.marker= new HBox();
                        legendData.aspectRatio=1;
                        return legendData;
                   private function findLegendDPData(ip:String):int{
                        for(var i:int = 0;i < legendDP.length;i++){
                             if(legendDP[i].label == ip)
                                  return i;
                        return -1;
                   /* [Bindable]
                   public function get legend():ArrayCollection
                        var legend:ArrayCollection = new ArrayCollection();
                        for (var i:int = 0; i < statsPpg.length; i++)
                             var dataObject:Object = statsPpg[i][0];
                             legend.addItem(newLegendData(dataObject.IP.toString()));
                        return legend;
                   [Bindable]
                   public function set legend(legendData:ArrayCollection):void
                             legend = legendData;
                   private function initLegend():void
                        for (var i:int = 0; i < statsPpg.length; i++)
                             var dataObject:Object = statsPpg[i][0];
                             legendDP.addItem(newLegendData(dataObject.IP.toString()));
                   private function yAxisLabel(value:Object, previousValue:Object, axis:IAxis):String
                        return value + ' %';
              ]]>
         </mx:Script>
         <mx:Panel width="790" title="CPU.IP" layout="horizontal">
              <mx:LineChart  id="chartPPG" name="Comparison" showDataTips="true">
                   <mx:horizontalAxis>
                        <mx:CategoryAxis dataProvider="{statsPpg[0]}" categoryField="dayTime" title="Days" id="categories"/>
                   </mx:horizontalAxis>
                   <mx:verticalAxis>
                        <mx:LinearAxis labelFunction="{yAxisLabel}"  title="CPU" id="yAxis"/>
                   </mx:verticalAxis>
                   <!--<mx:series>
                        <mx:LineSeries id="CPU" yField="CPU" xField="dayTime" displayName="CPU  "/>
                        <mx:LineSeries id="IP" yField="IP" xField="IP" displayName="IP  " />
                   </mx:series>-->
              </mx:LineChart>
              <!--<mx:Legend dataProvider="{chartPPG}" markerWidth="50" markerHeight="4" legendItemClass="MyLegendItem" direction="vertical"  width="174"/>-->
              <!--<mx:Legend id="myActionScriptLegend" creationComplete="createDynamicLegend(event)" />-->
              <mx:Legend id="userLegend" dataProvider="{legendDP}"/>
              <mx:Button label="AddNewData" click="modifyData()"/>
         </mx:Panel>
    </mx:Application>
    the result is here:
    Question:
    1.I using the binding ArrayCollection  legendDP as the Legend's dataprovider, the Legend's showing not changed  when the legendDP changed
    2.How can I fill the Legend's color,the result has no color showed.

    Can anyone help?

  • How do I create a dynamic parameter based on a formula?

    Hi,
    I've developed a report, in CR 11, that is parameterized based on the field "ticket_date".  I've created a Min and a Max formula so that I can select a date range. This works wonderfully. However, my date list is growing longer by the day and each day I have to run the report I need to scroll through an even longer list of date values. This will become increasingly impractical with each passing month and year.  I would like create a "Year" paramater and a "Month" parameter so that I can first select the Year, then the month(s), then the dates.
    When I attempted to create a parameter based on the formula, "Year (), the formula wasn't in the list of available values to create a parameter on.
    How can I address this requirement?
    thanks in advance!
    Mark

    Hi Abhilash,
    Looks like I was able to create a Year field in the Command - thanks for the tip!
    Before I close this off as answered can you take a look at two sets of SQL I wrote in the Command that I'm getting errors on and offer advice on where the error is occurring.
    Example 1
    The SQL I attempted to write must be close though:
    Select ft.sequence, ft.ticket_date, coff.office_name, comp.subscriptions_id from
    field_tickets as ft, company_offices as coff, companies as comp
    INNER JOIN jobs ON comp.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    LEFT JOIN company_offices ON jobs.company_offices_id=company_offices.company_offices_id
    Where comp.subscriptions_id=7.00
    When I attempt to save this I get an error:
    "Failed to retrieve data from the database. Details: Exception: Error Message: Java Heap Space"
    Example 2
    I get the error, "Not unique table/alias: 'custom_jobs_values'" for the following SQL Command
    SELECT companies., jobs., field_tickets., regions., customers., custom_jobs_values. FROM
    companies, jobs, field_tickets, regions, customers, custom_jobs_values
    LEFT JOIN custom_jobs_values ON jobs.jobs_id=custom_jobs_values.jobs_id
    INNER JOIN regions ON companies.regions_id=regions.regions_id
    INNER JOIN jobs ON companies.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    INNER JOIN customers ON jobs.customers_id=customers.customers_id and
    companies.subscriptions_id=4.00
    thanks!
    Mark

  • How can I create a dynamic XML driven PDF Portfolio?

    I have built an XML application for which I maintain a library of individual PDF page "templates" used to assemble large (1000+ pages) PDF documents. The page templates are saved as PDFs without page numbers as they can be reused anywhere in any manual, the page numbers are applied during the document assembly process. I am now attempting to implement an update process, in which one template change can impact dozens of large documents. I am therefore looking at moving away from creating these large PDF documents and creating something more along the lines of a Package, Portfolio or other solution in which document pages/templates in the library are linked to rather than combined, so that changes across multiple large documents can be done quickly and transparently to the user. I am sure there is a solution using an Adobe spec like Portfolio or XDP, I just need a nudge down the right path, as nothing in what I've read explicitly states that these technologies can be used for this purpose. I would prefer to stay within technologies I am comfortable with to create/modify the necessary files, whcih are XML/XSLT and ANT. I would also like to know if it's possible to add page numbers on the footer of each page in the Portfolio without modifying the template, and if the resulting Portfolio can be saved as a normal PDF or printed with the dynamic page numbers included.
    I know this might be a tall order but if anyone can help clarify what's possible with existing Adobe technologies it would be greatly appreciated.
    Thanks,
    Keith

    Indeed - PDF Portfolios are a collection of static files attached to a one-page cover sheet, you cannot have references to externally-stored documents.
    You can replace individual files in a Portfolio (by adding a file of the same name) but nothing happens automatically, and the file when added to the Portfolio will have no idea about where it originally came from. There's no concept of "check for updates".

Maybe you are looking for