Dynamic Creation and Plotting in CNiGraph

Hi,
I would like to create a temporary CNiGraph object, plot some data, and render it to an image.  I am able to create the object dynamically (I think) but I get a runtime error when trying to plot data (using ChartY) on the graph.
The error is in the function AfxGetAmbientActCtx.
My code for control creation looks like:
  CNiGraph niGraph;
CRect rect(CPoint(0, 0), m_Size); // the size of the graph
CDC *pDC = pWnd->GetDC();
BSTR bstrLic = :ysAllocStringLen(/* stuff to generate the license */);
niGraph.CreateControl("CWGraph", "", WS_VISIBLE, rect, pWnd,
                              m_staticControlID++, NULL, FALSE, bstrLic);
        //use the static control ID to ensure unique IDs
:ysFreeString(bstrLic);
ChartPreviewData(niGraph, pList, settings);
              // ... some untested code to render to an image follows 
 pWnd is a CPropertySheet (which is a valid window, but I am using as a dummy to temporarily hold the graph).  ChartPreviewData does this...
 void CXyzClass::ChartPreviewData(
CNiGraph &graph, ... some other arguments....)
                // some code to get the data ready to put in the NI vector
CNiReal64Vector niVector(numPoints, pBuffer);
graph.SetChartLength(numPoints);
// Chart data and adjust delta X to reflect sampling frequency used
CNiPlot plot = graph.Plots.Add();
plot.MultiPlot = TRUE;
plot.ChartY(niVector, (double) 1/pSeries->GetFs());  // crashes
delete pBuffer;
When I step through in the debugger, it looks like NiGraph gets created okay.  In fact, I can see it on the dialog.  However calling ChartY is giving me a runtime error.  I suspect I am missing something to do with ActiveX but I'm not sure what.
Thanks, Nick 
Solved!
Go to Solution.

Sorry, this is resolved.  I had a stupid error and was passing a zero-length vector to ChartY.
I dicovered that way up on the call stack a exception was being thrown because of this. 

Similar Messages

  • Dynamic creation of TabStrip

    Hi,
    I want to create a tabstrip dynamically.The tabstrip should have 3 tabs, and in each of the tabs i want to put some UI elements like a label, input field, dropdown, tables.........etc.
    Im able to create the tabstrip and add tabs to it dynamically.
    I've even created the UI elements which i wanted to put in the tabs.............But im not able to proceed as i dont know how to add the UI elements to the tabs.......
    Can anyone tell me how to add UI elements to a tab in a tabstrip?
    Regards,
    Padmalatha.K
    Points will be rewarded.

    Hi,
    Following code will help you to understand the dynamic creation and adding them
    //Tabstrip
           IWDTabStrip tabStrip = view.createElement(IWDTabStrip.class);
           //Tab
           IWDTab tab = view.createElement(IWDTab.class);
           //Input Field
           IWDInputField inputField = view.createElement(IWDInputField.class);
           //Adding inputfield to tab
           tab.setContent(inputField);
           //Adding tab to tabstrip
           tabStrip.addTab(tab);
    //Finally add this tabstip to either your root container or some other container.
    Regards
    Ayyapparaj

  • Dynamic Internal Table creation and population

    Hi gurus !
    my issue refers to the slide 10 provided in this slideshow : https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae
    My example is gonna sound dumb, but anyway: I want to dynamically select from a table into a dynamically created itab.
    Letu2019s use only EKPO, and only field MENGE.
    For this, I use Classes cl_abap_elemdescr, cl_sql_result_set and the Data Ref for table creation. But while fetching the resultset, program dumps when fields like MENGE, WRBTR are accessed. Obviously their type are not correctly taken into account by my program.
    Here it comes:
    DATA: element_ref             TYPE REF TO cl_abap_elemdescr,
          vl_fieldname               TYPE string,
                 tl_components         TYPE abap_component_tab,
                 sl_components         LIKE LINE OF tl_components_alv,
    linetype_lcl               TYPE REF TO cl_abap_structdescr,
    ty_table_type            TYPE REF TO cl_abap_tabledescr,
    g_resultset             TYPE REF TO cl_sql_result_set
    u2026
    CONCATENATE sg_columns-table_name '-' sg_columns-column_name INTO vl_fieldname.
    * sg_columns-table_name contains 'EKPO'
    * sg_columns-column_name contains 'MENGE'
    * getting the element as a component
    element_ref ?= cl_abap_elemdescr=>describe_by_name( vl_fieldname ).
    sl_components-name  = sg_columns-column_name.
    sl_components-type ?= element_ref.
    APPEND sl_components TO tl_components.
    * dynamic creation of internal table
    linetype_lcl = cl_abap_structdescr=>create( tl_components ).
    ty_table_type = cl_abap_tabledescr=>create(
                      p_line_type = linetype_lcl ).
    u2026
    * Then I will create my field symbol table and line. Code has been cut here.
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    u2026
    * Then I will execute my query. Here itu2019s: Select MENGE From EKPO Where Rownum = 1.
      g_resultset = g_stmt_ref->execute_query( stmt_str ).
    * Then structure for the Resultset is set
      CALL METHOD g_resultset->set_param_struct
        EXPORTING
          struct_ref = dy_line.
    * Fetching the lines of the resultset  => Dumpu2026
      WHILE g_resultset->next( ) > 0.
        ASSIGN dy_line->* TO <dyn_wa>.
        APPEND <dyn_wa> TO <dyn_table>.
      ENDWHILE.
    Anyone has any clue to how prevent my Dump ??
    The component for MENGE seems to be described as a P7 with 2 decimals. And the resultset wanna use a QUAN type... or something like that !

    Hello
    I have expanded your sample coding for selecting three fields out of EKPO:
    *& Report  ZUS_SDN_SQL_RESULT_SET
    *& Thread: Dynamic Internal Table creation and population
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1375510"></a>
    *& NOTE: Coding for dynamic structure / itab creation taken from:
    *& Creating Flat and Complex Internal Tables Dynamically using RTTI
    *& https://wiki.sdn.sap.com/wiki/display/Snippets/Creating+Flat+and+
    *& Complex+Internal+Tables+Dynamically+using+RTTI
    REPORT  zus_sdn_sql_result_set.
    TYPE-POOLS: abap.
    DATA:
    go_sql_stmt       TYPE REF TO cl_sql_statement,
    go_resultset      TYPE REF TO cl_sql_result_set,
    gd_sql_clause     TYPE string.
    DATA:
      gd_tabfield      TYPE string,
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr_new    TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      gdo_handle       TYPE REF TO data,
      gdo_record       TYPE REF TO data,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
    FIELD-SYMBOLS:
      <gs_record>   TYPE ANY,
      <gt_itab>     TYPE STANDARD TABLE.
    START-OF-SELECTION.
    continued.

  • Dynamic Event Creation and Handling the events

    Hi All
    I am using WAS 6.4.
    I have two components say Component A and Component B in which Component A is a reusable component and is used by other components say for e.g the Component B.
    The following is the requirement.
    Component A should create buttons for other components dynamically.
    As an example, Component B specifies to Component A the buttons required say button B1 and button B2.
    Component B also contains methods M1 and M2 for the buttons created by the component A.
    Now I would like to associate these buttons created by component A with the methods created in Component B
    The number of buttons that are to be created may vary from component to component.
    If any one as any suggestion or solution, help me out.
    Thanks
    Regards
    NagaKishore

    Hi NagaKishore,
         I'm not exactly sure why you want to do this, but it is pretty easy if I switch it up a bit.  (Maybe you are trying to create a navigation page or something?) 
         Instead of your component B using component A, if you define a Web Dynpro interface in component A, then implement this interface in component B (or all component Bs), achieving your goal would not be too difficult.  It could define a generic method (or event) with a "button key" as an argument that would tell component B which button was pressed and allow it to behave as desired.  The Web Dynpro interface defined in A could also have an interface context that would allow the the button text to be passed along with (for the sake of simplicity) a "button key" that component that should be triggered when the button is pressed.  (Note this could be a varying size list as required.)
         The component B(s) need not be known until run-time.  They can be created using something like:
    wdThis.wdGet<Used Compontne Name>ComponentUsage().createComponent(<Component Name>,<Object Name (if in a different component)>)
         Once the component is created, the context can be accessed giving the list of buttons to create and the values.  The buttons can be created in the wdModifyView during the first pass of the creation of the view displaying the buttons (after the dynamic creation of the used components which can occur in the wdDoInit of the component controller).
         If the user presses a chosen button on component A, then the generic method (most likely an event) of component Bs interface is called and passed the "button key", component B then takes over.  Note this would also work if component B had a visualization component that must be displayed through an interface view that is defined on the web dynpro component interface that is implemented by B.
         Hope this helps or at least triggers discussion that will answer your question,
           --Greg

  • Dynamic domain-based entity creation and relation to base entity

    Hi everyone -
    My first post here...  I have a base entity (PROJECT) with an attribute called RecordType (a domain-based attribute).  Depending on the value of RecordType, the business wants to use that result set as input for another reference entity, and then
    relate them together in a possible {one|many}-to-many relationship.  For example:
    If RecordType = Strategy, then there is a need to create a separate entity called STRATEGY with the results of that filter.  The PROJECT entity and STRATEGY now need to be related together in a PROJECT_STRATEGY relationship table.
    There seem to be a couple of options, but none are elegant, and some simply don't work:
    Option #1 (doesn't work): I create the relationship table (PROJECT_STRATEGY) with a domain-based attribute of the PROJECT entity and a second domain-based attribute of the PROJECT entity (but called Strategy), and then try to create a business
    rule that limits the selection of the second domain-based attribute by RecordType.  MDS tells me I can't use a domain-based attribute in the business rule.
    Option #2: I create a SQL Server view called STRATEGY (which is a query based on the PROJECT entity - "where RecordType = 'Strategy') and use that as the reference set.  However, there is now no way to utilize that result set inside MDS. 
    In other words, I cannot use it as a domain-based attribute in the PROJECT_STRATEGY relationship table.  This means that an external system/UI would need to enable the relationship selection and write back into the PROJECT_STRATEGY relationship table
    inside MDS.
    Option #3: I create a STRATEGY entity that is auto-updated (via SQL Server job) every 10 minutes or so from the PROJECT entity (can't figure out how to load a reference entity based on a result set from an existing entity).  This allows me to create
    two domain-based attributes in the PROJECT_STRATEGY table (as described in Option #1), but is also what I call a non-standard customization, so I have been reticent to go this route.
    So, my questions/comments are:
    Is there any way to make Option #1 work (using business rules)?
    Option #2: Our development team doesn't want to create a separate system/UI to relate the list of PROJECTs to the list of STRATEGYs and then write them back into the PROJECT_STRATEGY relationship table.  This also limits the ability to maintain the
    PROJECT_STRATEGY table inside MDS since the STRATEGY domain-based attribute would become a free-form attribute at that point.  Is there any way to register a view as a reference entity?
    Should I explore Option #3?  Non-standard, non-native functionality introduced into MDS (any system, really) is something I wanted to avoid, but only from a purity and possible upgrade standpoint.  Should I get over this?
    I have looked at derived and explicit hierarchies for the PROJECT entity, but they do not seem to apply in the scenario above.
    Has anyone tried to create {one|many}-to-many relationships between a base entity and a subset of that base entity without resorting to non-standard customizations within MDS?  Is this as bizarre as it sounds?
    Any help would be greatly appreciated.
    Thanks.

    Hi,
    I f you are going with rtti approach.... for dynamic creation....you can assign the checktable field in field cat
    ls_fcat-ref_table  = space.
        ls_fcat-ref_table  = 'ZST_DISTRIBUTED_EFFORT'.
        ls_fcat-ref_field  = 'WORK_EFFORT'.
        ls_fcat-rollname   = 'DPR_TV_EFFORT'.
        ls_fcat-domname    = 'DPR_WORK'.
        ls_fcat-reptext    = ls_fcat-fieldname.
        ls_fcat-scrtext_l  = ls_fcat-fieldname.
        ls_fcat-scrtext_m  = ls_fcat-fieldname.
        ls_fcat-scrtext_s  = ls_fcat-fieldname.
        ls_fcat-emphasize  = me->gc_flag_enable.
        ls_fcat-col_pos    = lv_counter.
    ls_fcat-checktable = ' '.
        APPEND ls_fcat TO lt_fcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = lt_fcat
        IMPORTING
          ep_table                  = et_dynamic_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc NE 0.
        es_message-id         = sy-msgid.
        es_message-type       = sy-msgty.
        es_message-number     = sy-msgno.
        es_message-message_v1 = sy-msgv1.
        es_message-message_v2 = sy-msgv2.
        es_message-message_v3 = sy-msgv3.
        es_message-message_v4 = sy-msgv4.
    Thanks,
    Shailaja Ainala.

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • Dynamic creation of context nodes and ui elements

    Hi,
    I have created context nodes dynamically. And i also want to create UI elements dynamically wherein i want to bind the attribute from the context node to it. For example i want to create a drop down by index and bind one of the attributes in the context nodes that i have earlier created dynamically to it.  I do not know how to get the path to the attribute as i get IF_WD_CONTEXTNODE_INFO when i say get_child_node(). And the IF_WD_CONTEXTNODE_INFO does not have any method where in i can get IF_WD_CONTEXT_NODE from where i can get the path by get_meta_path( )
    Here is the code. The problem is to get the path which is the i/p to cl_wd_dropdown_by_idx=>new_dropdown_by_idx( ) method.
    DATA:
            lo_root_ui_elmnt              TYPE REF TO cl_wd_uielement_container,
            lo_drpdwn_by_idx              TYPE REF TO cl_wd_dropdown_by_idx,
            lo_txt_vw                     TYPE REF TO cl_wd_text_view,
            lo_qstn_node                  TYPE REF TO if_wd_context_node,
            lo_optn_node_info             TYPE REF TO if_wd_context_node_info,
            lv_optn_data_source_name      TYPE string,
            lt_child_nodes                TYPE wdr_context_child_map,
            lo_qstn_el                    TYPE REF TO if_wd_context_element,
            lo_optn_el                    TYPE REF TO if_wd_context_element,
            lv_text                       TYPE string,
            lo_qstn_node_info             TYPE REF TO if_wd_context_node_info.
      FIELD-SYMBOLS:
    *                 <ls_qstn>    LIKE LINE OF wd_this->mt_questions.
                    <ls_child_node>         LIKE LINE OF lt_child_nodes.
      lo_root_ui_elmnt ?= io_view->get_root_element( ).
      lt_child_nodes = wd_context->get_child_nodes( ).
    LOOP AT lt_child_nodes ASSIGNING <ls_child_node>.
       lo_qstn_node = <ls_child_node>-node.
        lo_qstn_el = lo_qstn_node->get_element( index = 1 ).
        lo_qstn_el->get_attribute(
              EXPORTING
                name = 'QUESTION_TEXT'
               IMPORTING
                 value = lv_text ).
        lo_txt_vw =   cl_wd_text_view=>new_text_view( view = io_view ).
        lo_txt_vw->set_text( value = lv_text  ).
        lo_qstn_node_info = lo_qstn_node->get_node_info( ).
        lo_optn_node_info = lo_qstn_node_info->get_child_node( 'OPTIONS' ).
    *    lv_optn_data_source_name = lo_optn_node_info->get_meta_path( withoutcontroller = abap_true ).
    *    CONCATENATE lv_optn_data_source_name '.' 'OPTION_TEXT' INTO lv_optn_data_source_name.
        lo_drpdwn_by_idx = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
                              bind_texts = lv_optn_data_source_name
                              view       = io_view ).
        lo_root_ui_elmnt->add_child( lo_txt_vw ).
        lo_root_ui_elmnt->add_child( lo_drpdwn_by_idx ).
      ENDLOOP.
    Regards,
    Madhura Lobo
    Edited by: Suhas Saha on Aug 2, 2011 11:04 AM

    Hi Madhura,
    Please check this thread and find Baskaran answer...
    create new child-node in supply-function
    Re: Creating Dynamic Node and Table
    Cheers,
    Kris.

  • Dynamic creation of ComponentUsage

    Hi people,
    I want to reuse a view (ViewA) in different views (ViewB, ViewC, ViewD).ViewA has a quite complex logic, so it is necessary to outsource this view.  Not only the logic, but also the count of UIElements and contextelements is quite large, for this I don't want to implement this part redundant in the views A, C and D.
    I have to use ViewA in a table in  the TablePopin UIElement. Every line of the table should have its own instance of ViewA. Is that possible?
    My idea is it, to put the view in an own component. For every tableline I need an instance of the componentUsage. My problem is now, that I'm not able to create at runtime a ComponentUsage and at designtime I don't know how many instances I need. Is it possible in webdynpro to create dynamic instances of ComponentUsage?
    If you know an other way, that prevents me from implementing the view and its logic more times, please tell me!
    Thanks in  advance,
    Thomas Morandell

    Hi Thomas,
    just for clarification. Principally it is possible in Web Dynpro to dynamically create new component usages of the same type like an existing, statically declared one. This means after having defined a component usage of type ISomeComp (component interface definition) you can dynamically create new component usages which all point to the same component interface definition ISomeComp:
    wdThis.wdGetISomeCompUsage().createComponentUsageOfSameType();
    But this dynamic creation approach implies, that you must also embed the component interface view of this component usage to the view composition dynamically; and this is (unfortunately) quite cumbersome and complicated based on the existing Web Dynpro Java API (it is not yet optimized for a simple dynamic view composition modification.
    Additionally, like Valery pointed out, the dynamic creation of new component usages is not compatible with table popins.
    Regards, Bertram

  • Dynamic Creation of UI in adobe forms??

    Hi Experts,
    I need to create a dynamic interactive form and dynamic UI elements in the interactive form.
    As per my requirement I need to display a pdf and I will be getting values from the RFC's. I need to show the form segments and the UI elements only when there's a data from the RFC else not. I am unable to understand whether this requirement needs generation of the UI elements dynamically or I can do it statically as well.
    The form thus generated will be having data from the RFC which based on the data quantity may exceed to n number of pages.
    In case it needs dynamic creation can you suggest me please how to achive it in interactive forms?
    Helpful answers will be appreciated.
    Warm Regards,
    Gaurav

    Hi,
    subForm1:-
    Flow content
    Allow page breaks
    Place: following previous-----> This means when you are repeating the subform the previous one should be followed.
    Say you have a table and have 3 columns in it.
    After 1st column is completed, the next column should come with 1st comun
    After: Continue filling parent--->Continously fill the data with the parent element
    Repeat sub form min count is 1 : Minimum of 1 line item will be printed
    Height: Expand to fit is true.: If the field height is increased it automatically expands.
    For help in Adobe Press F1 or Goto Help--> Adobe Designer Help in Adobe Designer
    After installing Adobe Designer, goto the specific folder
    C:\Program Files\Adobe\Designer 8.0\EN you can get sample documents.
    For help press F1 after opening designer.
    Sub Form1: Content--> Flowed, Flow direction --> Top to bottom
                       Binding --> Check the checkbox Repeat Subform for each data item
    Subform 2: Content --> Positioned, No pagination No binding settings changes needed.
    Hey i forgot to mention the Header Subform where you create all these subforms should be flowed.
    Try it once like this and lte us know
    Edited by: Sankar Narayana on Oct 3, 2008 5:06 PM

  • Dynamic creation of date in selection variant

    Hi All,
    I have a Z program for updating a field in BOM item. One of the input field in the report is "Valid From Date". Actually the current date is automatically fetched through a function module and it is defaulted in that field. 
    Our client is using selection variant for ease of use. The problem here is old date in the selection variant  is replacing the current date. I want current date to be created automatically during insertion of variant also. How can i solve this problem. Is there any selection variable inside the variant for dynamic creation of Date?
    Thanks
    Sankar

    As I know there is no setting for this. For any std or Z report variant function with L should act same way...anyway you discuss with your ADABer.
    See the help for variables
    Selection Variables                                                                               
    The following three types of selection variables are currently          
        supported:                                                                               
    o   Table variables from TVARV                                          
            You should use these variables if you want to store static          
            information. TVARV variables are proposed by default.                                                                               
    o   Dynamic date calculations:                                          
            To use these variables, the corresponding selection field must have 
            type 'D' (date). If the system has to convert from type T to type D 
            when you select the selection variables, the VARIABLE NAME field is 
            no longer ready for input. Instead, you can only set values using   
            the input help.                                                     
            The system currently supports the following dynamic date            
            calculations:                                                       
            Today's date                                                        
           From beginning of the month to today                               
           Today's date +/- x days                                            
           First quarter ????                                                 
           Second quarter ????                                                
           Third quarter ????                                                 
           Fourth quarter ????                                                
           Today's date - xxx, today's date + yyy                             
           Previous month                                                                               
    o   User-specific variables                                            
           Prerequisite: The selection field must have been defined in the    
           program using the MEMORY ID pid addition. User-specific values,    
           which can be created either from the selection screen or from the  
           user maintenance transaction, are placed in the corresponding      
           selection fields when the user runs the program.                                                                               
    The SELECTION OPTIONS button is only supported for date variables that 
       fill select-options fields with single values.                         
    i.e means we can do that with D also.

  • Dynamic Tree and TreeNode Issue

    I am using JSC2 (060120) on Win2K pro, exporting the WAR and running in JBoss 4.0.3 running under JDK 1.5.0_04.
    I am trying to dynamically build a tree as the user clicks on nodes and am not having success following the example at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/sitemaptree.html
    When I attempt to add the child nodes directly to nodes via clickedNode.getChildren().add(myNewNode); I get an error as follows:
    10:17:29,260 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.el.ReferenceSyntaxException: AP-1030Child.id
    at com.sun.faces.application.ApplicationImpl.checkSyntax(ApplicationImpl.java:749)
    at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:291)
    The ID shown AP-1030Child.id does not exist, my to be parent node is named AP-1030 and my to be child is named AP-1030-Bottom.
    The only way I can get the Tree to build properly is to add the to be child (AP-1030-Bottom) to the Tree itself and then assign it's parent as the node (AP-1030). But, the problem I run into then is the next time the parent node (AP-1030) is clicked parent.getChildCount() or parent.getChildren().size() both evaluate to zero and I attempt to build the children for the node at which point the code blows up due to duplicate naming.
    Has anyone else experienced this? Am I doing something wrong?
    Here is the code I use to build my tree initially on the SessionBean...
    for(int i = 0; i < count; i++)
    TreeNode newNode = new TreeNode();
    newNode.setId("AP-" + pages.pageId);
    newNode.setText(pages[i].page);
    newNode.setImageURL("/resources/tree_document.gif");
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.treeNode_action}", null);
    newNode.setAction(nodeMethodBinding);
    this.applicationPagesTree.getChildren().add(newNode);
    Here is the code I am using to add the child nodes to the clicked node...
         for(int l = 0; l < locationsCount; l++) {                               
              TreeNode locationNode = new TreeNode();
    String sectionText = "";
              (populate sectionText with Top|Left|Center|Right|Bottom based on data)
              locationNode.setText(sectionText);
              // making unique name for this object in the tree: parentname + section
    locationNode.setId(searchID + "-" + sectionText);
    locationNode.setImageURL("/resources/tree_document.gif");
              // bind to method for the page sections click
    MethodBinding nodeMethodBinding = this.getApplication().createMethodBinding("#{MainPage.locationNode_action}", null);           locationNode.setAction(nodeMethodBinding);
              // adding to the base tree object after the parent (why can I just not add to the node?)
              this.treeList.getChildren().add(insertIndex + l, locationNode);
              // this nudges the node over one, otherwise it is peer to the parent (again, why not just add to the parent?)
    locationNode.setParent(node);
    Why is it I can get the String ID from the tree and not the object? Wouldn't it make sense to give me the TreeNode instead of it's ID when calling getCookieSelectedTreeNode()? This would seem a more proper object orientated approach.
    Any help appreciated, thanks.

    Thanks,
    I have tried pretty much that exact same code and it does not work for some reason. That code is the same as the example I showed that I followed originally.
    The only way I can get it to work is as I showed. When I do the node creation and then add to the node in the tree it blows up while rendering with the message from the original post.

  • Xy graph with dynamic number of plots

    I've got an XY Graph with some dynamic number of plots to graph. Once I know this number, I change the LegPlots property and plot the data from an array containing all the plots. The data is displayed correctly, but I get overlapping colors. Say I'm only trying to graph 3 plots. I get three lines (good) but then the three lines have 29 colors (bad), as if it's plotting all possible plots at the data points of the three. The legend updates to only show three (good), but am I missing something else? Does the LegPlot property not govern that, but only governs the legend itself?

    If the problem is the code then I'll take a look at my mess of wire, I just wanted to see if it was the LegPlots property first.
    Here's what it looks like, just in case
    Attachments:
    toomanycolors1.JPG ‏25 KB

  • Dynamic Tables and UI

    Hello All,
    I hope i am posting this in the right area. Please excuse if i am not.
    I have a pretty unusual problem.
    I have a table with the following columns. "EXTERNAL_ID" "PERIOD" "AMOUNT" and other fields.
    in this table, period is a date value and external_id refers to some project. (This is not unique)
    i am having values in the fields like
    101000 20081101 8
    101000 20081201 9
    101000 20090101 25
    101453 20081101 5
    and so on.
    i would like to put these into an internal table ( Context table ) of the form "External_ID" "NOV-08" "DEC-08" and so on............
    the data should look like
    101000 8 9 25
    101453 5
    One additional problem here is that the dates are dynamic and can differ every time the program is run.
    Is there any way to do this efficiently. The number of rows in my first table can be very large (upto 80000 )
    Thanks & Regards,
    Mz

    Hi,
    Then you need to build the dynmic node to acheve this.
    Depending on the numdber of months,  I guess this can be known based on some input. Some basic criteris should be there as how to get the number of mothns, based on this create a Dynamic Internal table with that many columns and bind the saame to the dynamic node.
    For Ex: If a project runs for a ayear/months, i will get fical periods for a project suing some standard FM. we can get to know this right.
    Are you using normal Table UI or ALV to display.
    Refer Dynamic Node and Internal table creation  -
    Re: Create dynamic table of dynamic node
    Regards,
    Lekha.

  • Logic of array and plotting functions?

    Hi,
    I started to build versatile acquisition programn with labview (with NI cards it seemed to be the best option) and it took quite an effort to adjust the way of thinking while shifting from other programming environments. I start to see the logic behind the labview but I have serious difficulties on figuring out how the labview's array and plotting functions work. Here's a simple example for replacing array subset and plotting it, which just doesn't work as i'd expect. I thought this would first initialize 10 rows, 1000 cols matrix of which the certain row would be replaced (zero padding when new row is longer than the original). The resulting matrix would then be displayed each row having its own windows in the stacked plot. It seems to do something totally different...
    Attachments:
    koe4.vi ‏303 KB

    As you noticed, "Replace Array Subset" can only replace array elements that exist. If it's not there, there's nothing to replace.
    What you'll need to do is make the array larger by using the "Insert into Array" function. Use this function cautiously though. It requires LabVIEW to dynamically reallocate memory while the program is running, and takes time. If you only do the 'Insert' when needed, you should be OK.
    Use the "Array Size" function to get the size of the array to be inserted, then you can choose between the ‘Insert’ or ‘Replace’ functions.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Help with dynamic datasource and record selection

                                                                                                                                                                                                                                                                                     <span>Hi, I&#39;m having some difficulty with part of an application I&#39;m trying to build, but here&#39;s some background first.<br /> <br /> I am a student at the University of Maryland, and I&#39;m writing an application for one of the departments here at the university.  It is sort of a front-end for an access database with a lot of extra functionality.  This includes reports.  First of all, the user can change the databse that the application uses, so I store that in an appsetting.  For this reason, I have to tell the report what database to use at runtime rather than using the database expert.  I am building a sort of report wizard in which the user selects certain values, and based upon those values, the SQL statement that the report gets data from changes.  So almost everything about the report&#39;s data is dynamic and will be determined at runtime.  <br /> <br /> So for example if the user chooses an officer report by chapter names, I do this (chapters is a comma delimited string):<br /> <br /><span style="font-weight: bold"> string sel = "SELECT * FROM [Undergrad Leadership] WHERE [Leadership Position] = &#39;" + txtPosition.Text + "&#39; AND [Chapter Name] IN (" + chapters + ");";</span><br /> <br /> The part I am lost on, is how to actually interface with crystal reports.  In the following code, conn is an OleDbConnection to the correct database, rep is the ReportDocument, and view is a CrystalReportsViewer.<br /> <br /><span style="font-weight: bold"> rep.DataSourceConnections[0].SetConnection(conn.DataSource, conn.Database, false); <br /> rep.RecordSelectionFormula = sel;</span><br /><span style="font-weight: bold"> view.ReportSource = rep;</span><br /> <br /> When I try to load the report, I get the following error message:<br /> Error in formula <Record Selection>:  a number, currency amount, boolean, date, time, date-time, or string is expected here.<br /> <br /> Also, assuming this formula gets fixed, how do I actually get fields from this formula and datasource onto my report, since I can&#39;t do it at design time?  Thanks in advance for the help.<br /> <br /> -Jared<br />    </span>

    <p>RCAPI (Report Creation and Modification) calls are only available with Crystal Reports Server RAS SDKs.  This means that using the bundled version of Crystal Reports for Visual Studio will not allow you to place fields onto the report.  A free copy of Crystal Reports Server comes with a registered copy of Crystal Reports Developer.  My guess is that you don&#39;t have either of these products and that you are just using the product that came with Visual Studio.</p><p>All is not lost.  The first question is, do you really need to add the fields at runtime?  In many cases developers just want to have control of the data that gets sent to the report and they are ok with having the same fields display.</p><p>In your code you are changing the datasource which is fine, and you are assigning a Record selection formula which is also fine.  </p><p>The problem with the record selection is that it doesn&#39;t fit the syntax of the Report.  I would suggest printing out the value that you programatically get for the formula and insert it into the Crystal Report Designer.  You will probably get the same error there and gets some  hints as to why it doesn&#39;t work.</p><p>What I would suggest is creating a template report that already has the fields on the report and then change its datasource at runtime and add a RecordSelectionFormula.</p><p>Otherwise you will have to use RAS to be able to add fields at runtime. </p><p>Rob Horne<br /><a href="/blog/10">Rob&#39;s blog - http://diamond.businessobjects.com/blog/10</a></p>

Maybe you are looking for