Dynamic Formula Creation

Hi,
I want to derive a formula based on the below table.
LINE_NO
OPERATOR
VARIABLE
1
A
2
+
B
3
C
4
D
5
6
+
E
7
8
F
9
G
10
The formula will always concatenate the operator with the variable for each step and it will formulate a complete formula at the end by concatenating the operator and variable columns in each step.
so if i formulate it , the formula would be A+B(C/D)+E*(F/G)
I want the formula to be generated dynamically at the run time.
Could any body please help me in how to formulate it?
Any immediate help is highly appreciated.

Here we go... not difficult to put it in PL/SQL...
SQL> select * from fm;
   LINE_NO O V
         1   A
         2 + B
         3 *
         4 ( C
         5 / D
         6 )
         7 + E
         8 *
         9 ( F
        10 / G
        11 )
11 rows selected.
SQL> set serverout on
SQL> ed
Wrote file afiedt.buf
  1  declare
  2    a number := 3;
  3    b number := 4;
  4    c number := 6;
  5    d number := 2;
  6    e number := 3;
  7    f number := 6;
  8    g number := 2;
  9    formula varchar2(100);
10    result  number;
11  begin
12   select x.formula
13         ,to_number(y.column_value) as result
14   into formula, result
15   from (
16         select replace(sys_connect_by_path(replace(operator,'/',' div ')||
17                                            decode(variable,'A',a,'B',b,'C',c,'D',d,'E',e,'F',f,'G',g)
18                                           ,'~'),'~') as formula
19         from   fm
20         where connect_by_isleaf = 1
21         connect by line_no = prior line_no + 1
22         start with line_no = 1
23        ) x
24       ,xmltable(x.formula) y;
25    --
26    dbms_output.put_line('Formula: '||formula);
27    dbms_output.put_line('Result : '||result);
28* end;
SQL> /
Formula: 3+4*(6 div 2)+3*(6 div 2)
Result : 24
PL/SQL procedure successfully completed.

Similar Messages

  • Dynamic Table Creation & Fill Up

    Hello,
    Can anyone please guide where I can find examples for dynamic table creation (programmaticaly), with dynamic number of columns and rows, used to place inside text components (or whatever) to fill them with data.
    All programmatic.
    Using JSF, ADF BC
    JDeveloper 10.1.3.1
    Thanks
    Message was edited by:
    RJundi

    Hi,
    Meybe this article helps: http://technology.amis.nl/blog/?p=2306
    Kuba

  • Does Seeburger's SFTP adapter support dynamic filename creation

    Hi all,
    Does the SFTP adapter support dynamic filename creation.
    If yes, then do we have to use UDF's and are there any specific settings that have to be done in the SFTP communication channel.
    Please provide a blog which helps in the configuration process of the above case.
    thanks,
    younus

    Dynamic Creation of File using counter in Seeburger Variable:
    1. Configuration Needed in the Communication Channel:
    The process of dynamic creation of files can be done we have to select the following checkbox in the receiver channel:
    Dynamic Attribute in receiver Channel:
    Import the following modules:
    Localejbs/Seeburger/solution/sftp
    Localejbs/Seeburger/AttribMapper
    Localejbs/ModuleProcessorExitBean
    Enter  the desired file naming convention:
    Use the Parameter GetCounter("ID") to the place where the counter is expected to come.
    2. Configuration Needed in the SeeBurger Workbench:
    If the J2EE server is listening on a port different from 50000 (which is the standard for the SAP client 000), the port number must be configured:
    Login into the seeburger workbench using the URL
    http://<localhost>:<port number>/seeburger/index.html
    Select Property Store.
    Create or edit the following property:
    Parameter
    Value
    Namespace
    http://seeburger.com/xi/SeeFunctions
    Key
    provider.servlet.server
    Value
    http://localhost:50000/ (where the port number 50000 must be set
    accordingly to the J2EE server configuration).
    Note: The configured value (server URL) has to end with a slash (/). Otherwise,
    SeeFunctions will not work correctly.
    If we need to start the counter from any specific value , it can be configured in the SeeBurger workbench, this value can be maintained in Mapping Variables :

  • Does UCM support dynamic page creation on contributor mode.?

    Hi All,
    Does UCM support dynamic page creation on contributor mode.
    We want to create new pages and link it into the existing pages
    is that possible?
    Thanks
    ~Hari

    You can create new secondary pages in contributor mode - you would normally do this via a dynamic list fragment though technically you could also achieve it by switching region content and creating new data files. You can then use the linz wizard to link between pages.
    If you are talking about creating new primary pages and sections in your site then you would need to use something like Site Studio Manager fragment.
    Tim

  • Headcount for all months and dynamic formula in HR Module

    Hi all,
    I am new to HR module, I had requrement like user will i/p from date and to date for calmonth based upon that i need to create a report i, and in the report i need to  calculate the %attrition(leavers rate)
    I am uploading  from a flat file and the fields in the flat file contains empno,emplocation,empdepartment,Dateofjoining,dateofreleiving
    suppose if the user enters from 05.2008 till 06.2008 means my formula will look like
    the formula to calulate %attrition = totalemployquit/(opening headcount of 1st of 05.2008Closing headcount of end of 05.208)/2opening headcount of 1st of 06.2008+Closing headcount of end of 06.2008)/2)/No of months 365/No of days elapsed100
    if user enters 03.2008 till 05.2008 means my formula will chage accordingly:
    totalemployquit/(opening headcount of 1st of 03.2008Closing headcount of end of 03.208)/2(opening headcount of 1st of 04.2008Closing headcount of end of 04.208)/2opening headcount of 1st of 05.2008+Closing headcount of end of 05.2008)/2)/No of months 365/No of days elapsed100
    Please help me out that sap has the facility for dynamic formula and also how can i find the  opening and closing headcount .
    I already gone through  Personal administartion link and all so please dont provide me the link in help .sap.com  and all,but it would be help full if telling me the way to implement the keyfigures 0HDCNT_VC and 0HDCNT_NC in this case .

    Mr Vinay
        Here u can do one thing by creating custom exit variable and write code for the same in CMOD.
        With this variable u can populate what ever u want.
         Recently i got this req & i solved .
    Warm Regards,
       Hari

  • RE: dynamic widget creation

    This is a good tech note about this on the Forte website.
    -----Original Message-----
    From: Matthew Middleton [SMTP:[email protected]]
    Sent: Friday, 25 June 1999 11:11
    To: [email protected]
    Subject: dynamic widget creation
    I have done a few windows with dynamic widget creation. Sometimes it
    seems I have to have done self.Open before, to get things to appear
    properly, and sometimes not.
    What I would like is a summation of the issues involved here so I can
    write such code without resorting to trial and error.
    with advance appreciation,
    Matthew
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Tech Note 5156, which I have attached for your information.
    -----Original Message-----
    From: Foster, Todd [SMTP:[email protected]]
    Sent: Saturday, 26 June 1999 1:27
    To: 'Jason de Cean'
    Subject: RE: dynamic widget creation
    ? What technote ?
    -----Original Message-----
    From: Jason de Cean [SMTP:[email protected]]
    Sent: Thursday, June 24, 1999 9:19 PM
    To: 'Matthew Middleton'
    Cc: 'Forte Users'
    Subject: RE: dynamic widget creation
    This is a good tech note about this on the Forte website.
    -----Original Message-----
    From: Matthew Middleton [SMTP:[email protected]]
    Sent: Friday, 25 June 1999 11:11
    To: [email protected]
    Subject: dynamic widget creation
    I have done a few windows with dynamic widget creation. Sometimes
    it
    seems I have to have done self.Open before, to get things toappear
    properly, and sometimes not.
    What I would like is a summation of the issues involved here so Ican
    write such code without resorting to trial and error.
    with advance appreciation,
    Matthew
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/>

  • Dynamic Report Creation At Runtime

    I am trying to create a dynamic crystal report at run time from Visual Studio 2013 using C#.  My back end database is SQL Server 2005.  The source for my crystal report is a SQL Server stored procedure which takes two parameters, a year (smallint) and a quarter (tinyint).  The stored procedure uses dynamic SQL and creates a dynamic temp table.  It returns the result set from a select on the temp table.  The number of columns in the result set will be determined at run time.  Right now it returns 40 columns.  It can return additional columns in multiples of 6.  All of these columns will need to be displayed on the crystal report at run time.  The C# application will run on 64 bit Windows 7 machines and the SQL Server database is on a 32 bit server.
    I have been successful in designing a crystal report within the Visual Studio IDE using this stored procedure and running it and displaying it in the crystal reports viewer from within the C# application.  So when the appropriate application's menu item is clicked, the form with the crystal viewer on it opens and displays the report.  So I know that I can connect to the database and display the report.  However as stated in the preceding paragraph, I need to create the crystal report at run time as the number of columns on the report will be variable.
    I have looked at the CrystalDecisions SDK and API and tried without success to do this.  I am getting errors when trying to connect to the DB through the API and am not able to retrieve the data.  I have played with the code for about a week with no success.  I have tried the code in the discussion forums without success.  The documentation for the SDK API's does not provide the level of detail that I need.  The CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo class has an attributes property that needs to be set.  I don't know what the proper settings should be.
    I prefer to use the OLE DB native client for SQL Server.
    Any help would be greatly appreciated.
    Martin

    Hi Ludek,
    I have made some small progress.  I can now login from work as well as get to links.  But it seems I am still blocked for zip files.
    I also have the utility working.  But whenever I try to add my dummy crystal report (dummyreport.rpt) to the project, visual studio 2013 hangs up and I have to kill VS.
    I added the following code to my form and ran it but I get the following error:
    System.Runtime.InteropServices.COMException was unhandled
      HResult=-2147352565
      Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
      Source=CrystalDecisions.ReportAppServer.DataDefModel
      ErrorCode=-2147352565
      StackTrace:
           at CrystalDecisions.ReportAppServer.DataDefModel.TablesClass.get_Item(Int32 Index)
           at Retail_Incentive_Plan.ReportForm3..ctor() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\ReportForm3.cs:line 123
           at Retail_Incentive_Plan.MDIParent.ShowNewForm(Object sender, EventArgs e) in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\MDIParent.cs:line 27
           at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
           at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
           at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ToolStrip.WndProc(Message& m)
           at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at Retail_Incentive_Plan.Program.Main() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\Program.cs:line 18
      InnerException:
    The error occurs at this line of code:
    boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
    I'm sure it must be something with the attributes that I am setting.  But I'm not sure of what the correct values for some of these attributes should be.  By the way, I am using the RCAPI approach rather than the formulas approach (for now).
    Here is my code that is in the form:
    public ReportForm3()
    //**************************   ChangeConnectionInfo   ******************************************************************************************************************
    ReportDocument boReportDocument = new ReportDocument();
    //**EDIT** Change the path and report name to the report you want to change.
    boReportDocument.Load(@"c:\Retail_Incentive_Plan\DummyReport.rpt", OpenReportMethod.OpenReportByTempCopy);
    //Create a new Command Table to replace the reports current table.
    CrystalDecisions.ReportAppServer.DataDefModel.CommandTable boTable =
    new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable();
    //boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
    PropertyBag boMainPropertyBag = new PropertyBag();
    //boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
    //In the main property bag (boMainPropertyBag)
    PropertyBag boInnerPropertyBag = new PropertyBag();
    //Set the attributes for the boInnerPropertyBag
    boInnerPropertyBag.Add("Auto Translate", "-1");
    boInnerPropertyBag.Add("Server", "MyServerName");
    boInnerPropertyBag.Add("Connect Timeout", "15");
    boInnerPropertyBag.Add("Data Source", "vancsdb02");
    boInnerPropertyBag.Add("General Timeout", "0");
    boInnerPropertyBag.Add("Initial Catalog", "Retail_Incentive_Plan");
    boInnerPropertyBag.Add("Integrated Security", "True");
    boInnerPropertyBag.Add("Locale Identifier", "1033");
    boInnerPropertyBag.Add("OLE DB Services", "-5");
    boInnerPropertyBag.Add("Provider", "SQLOLEDB");
    boInnerPropertyBag.Add("Tag with column collation when possible", "0");
    boInnerPropertyBag.Add("Use DSN Default Properties", "False");
    boInnerPropertyBag.Add("Use Encryption for Data", "0");
    //Set the attributes for the boMainPropertyBag
    boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
    boMainPropertyBag.Add("QE_DatabaseName", "Initial Catalog=Retail_Incentive_Plan");
    boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
    //Add the QE_LogonProperties we set in the boInnerPropertyBag Object
    boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
    boMainPropertyBag.Add("QE_ServerDescription", "MyServerName");
    boMainPropertyBag.Add("QE_SQLDB", "True");
    boMainPropertyBag.Add("SSO Enabled", "False");
    //Create a new ConnectionInfo object
    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
    new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
    //Pass the database properties to a connection info object
    boConnectionInfo.Attributes = boMainPropertyBag;
    //Set the connection kind
    boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
    //**EDIT** Set the User Name and Password if required.
    boConnectionInfo.UserName = "myUserName";
    boConnectionInfo.Password = "MyPassword";
    //Pass the connection information to the table
    boTable.ConnectionInfo = boConnectionInfo;
    //Get the Database Tables Collection for your report
    CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
    boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
    //For each table in the report:
    // - Set the Table Name properties.
    // - Set the Command table's command text.
    // - Set the table location in the report to use the new modified table
    boTable.Name = "Command";
    boTable.QualifiedName = "Command";
    boTable.Alias = "Command";
    //boTable.CommandText = "select country, region, city from customer where country='usa'";
    boTable.CommandText = "exec get_branch_ranking_data, 2015, 1";
    boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
    //Verify the database after adding substituting the new table.
    //To ensure that the table updates properly when adding Command tables or Stored Procedures.
    boReportDocument.VerifyDatabase();
    //return boReportDocument;
    //**************************   End ChangeConnectionInfo   ***************************************************************************************************************
    I'm sure that "vancsdb02" is incorrect in the Data Source in the code above but I'm not sure what goes there.
    All of my assemblies are set in my project as well as in the top of my code.  I just didn't show it here for brevity.
    Will pick up again with this on Monday.
    Martin

  • 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

  • Retain value of dynamic formula

    Here is my question...
    I have a check box in column A, in column B I have the following formula: =IF(A1=FALSE,"0",TODAY()). So basically, when I check the box I get today's date, but it is dynamic and the day changes unless I remove the formula and input the actual date.
    What I would like is for the date to remain static. In other words, if I check the box on Dec 29, 2010, I want that date to remain indefinitely instead of changing each day. Is there anyway to do this?
    Thanks for any help.
    Clay

    clayphillips wrote:
    I have a check box in column A, in column B I have the following formula: =IF(A1=FALSE,"0",TODAY()). So basically, when I check the box I get today's date, but it is dynamic and the day changes unless I remove the formula and input the actual date.
    What I would like is for the date to remain static. In other words, if I check the box on Dec 29, 2010, I want that date to remain indefinitely instead of changing each day. Is there anyway to do this?
    Hi Clay,
    Here are two routes:
    1
    Delete the checkbox.
    Insert the date using Insert (menu) > Date & Time
    (or use the keypress combination shift-option-command-D).
    This inserts a fixed Date and Time value with the current Date and the time set to 00:00:00.
    Only the Date is displayed.
    2
    Insert the date using the checkbox (as you've been doing), then select the cell containing the date.
    Copy.
    Go Edit > Paste Values.
    This replaces the formula in the cell with the value (a Date and Time value as above) calculated by the formula.
    In either case the result is a fixed value that won't change until you actually change it.
    Regards,
    Barry

  • AFAB dynamic variant creation for Posting period.

    HI,
    Business Requirement :
    Business want to run AFAB transaction code every month automatically with schedule job.
    system should pick present month period in posting period field.
    i checked in variant creation  against posting period there is no dynamic " D " in selection variable column.
    how can i fix this.

    Hi Jani,
    Check with abaper if TVARV table can Help you in this case, or create a z program from AFAB. And add date field to it, and schedule job based on that,
    I think TVARV table will be a better approach.
    Another point to consider here would be that dep should be run once business is ready to do so, and has its own hick ups in business if corrections are required to be made after executing AFAB by job
    Regards
    Pankaj B.

  • Dynamic formula problem

    hi  experts,
    my customer requires that:
    for example,
    for year 2007
    field1   field2   field3
    A1       B1      =A1+B1
    A2       B2      =A2+B2
    for year 2008
    field1   field2   field3
    A1       B1      =A1*B1
    A2       B2      =A2*B2
    as show above the field3 dynamic change according to the 0calyear
    how to do? hunger for ur advice and thanks a lot!

    Your formula can look like this:
    (A+B)(year == 2007) + (AB)*(year == 2008)
    The equality tests evaluate to 1 if true and 0 if false for the query formulas.

  • Dynamic Datasource creation

    I am trying to create datasources dynamically. Using an example from a previous
    post,
    mbeanHome = lookupMBeanHome();
    JDBCDataSourceMBean dsMBean = (JDBCDataSourceMBean)mbeanHome.createAdminMBean(poolName,"JDBCDataSource",
    mbeanHome.getDomainName());
    dsMBean.setJNDIName(poolName);
    dsMBean.setPoolName(poolName);
    dsMBean.addTarget(tserverMBean);
    dsMBean.setPersistenceEnabled(false);
    How can I retrieve the proper TargetMBean reference to send to the addTarget method.
    Does anyone know where I can find an entire class example of dynamically creating
    datasources, or something similar.
    Thanks in advance,
    Fahd

    Hi Fahd,
    Here is a sample I posted here some time ago
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.Iterator;
    import java.util.Set;
    import javax.naming.Context;
    import javax.sql.DataSource;
    import weblogic.jndi.Environment;
    import weblogic.management.configuration.JDBCDataSourceMBean;
    import weblogic.management.configuration.ServerMBean;
    import weblogic.management.MBeanHome;
    * This class demonstrates dymamic creation,
    * using and deletion of DataSource via
    * Weblogic management API.
    public class DynamicDataSource {
    private Context ctx = null;
    private JDBCDataSourceMBean dsMBean = null;
    private MBeanHome mbeanHome = null;
    private ServerMBean serverMBean = null;
    // DataSource attributes
    private String cpName = "yourPoolName";
    private String dsJNDIName = "dynamic-data-source";
    private String dsName = "dynamic-data-source";
    // Security credentials
    private String password = "admPasword";
    private String serverName = "yourServer";
    private String url = "t3://localhost:7701";
    private String userName = "system";
    * Creates and starts up a DataSource using
    * management API.
    public void createDataSource() throws SQLException {
    System.out.println("Creating DataSource...");
    try {
    // Get context
    Environment env = new Environment();
    env.setProviderUrl(url);
    env.setSecurityPrincipal(userName);
    env.setSecurityCredentials(password);
    ctx = env.getInitialContext();
    // Lookup for MBean home
    mbeanHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    serverMBean = (ServerMBean)mbeanHome.getAdminMBean(serverName,
    "Server");
    // Delete if DataSource MBean already exists in active domain
    Set dsMBeanSet = mbeanHome.getMBeansByType("JDBCDataSource",
    mbeanHome.getDomainName());
    Iterator iter = dsMBeanSet.iterator();
    while(iter.hasNext()) {
    JDBCDataSourceMBean dsmb = (JDBCDataSourceMBean) iter.next();
    if (dsmb.getJNDIName().equals(dsJNDIName)) {
    dsMBean = dsmb;
    deleteDataSource();
    break;
    // Create DataSource MBean
    dsMBean = (JDBCDataSourceMBean)mbeanHome.createAdminMBean(
    dsName, "JDBCDataSource",
    mbeanHome.getDomainName());
    // Set DataSource attributes
    dsMBean.setJNDIName(dsJNDIName);
    dsMBean.setPoolName(cpName);
    // Startup datasource
    dsMBean.addTarget(serverMBean);
    } catch (Exception ex) {
    throw new SQLException(ex.toString());
    * Symply gets and closes a connection from dynamic
    * DataSource. Will throw a SQLException if datasource
    * does not exists.
    public void createConnection() throws SQLException {
    System.out.println("Getting Connection...");
    try {
    DataSource ds = (DataSource)ctx.lookup (dsName);
    Connection conn = ds.getConnection();
    conn.close();
    } catch (Exception ex) {
    throw new SQLException(ex.toString());
    * Shuts down and deletes DataSource from configuratrion
    * using management API.
    public void deleteDataSource() throws SQLException {
    System.out.println("Deleting DataSource...");
    try {
    // Remove dynamically created datasource from the server
    dsMBean.removeTarget(serverMBean);
    // Remove dynamically created datasource from the configuration
    mbeanHome.deleteMBean(dsMBean);
    } catch (Exception ex) {
    throw new SQLException(ex.toString());
    public static void main(String args[]) {
    DynamicDataSource dds = new DynamicDataSource();
    try {
    dds.createDataSource();
    dds.createConnection();
    dds.deleteDataSource();
    } catch (SQLException ex) {
    ex.printStackTrace();
    "Fahd" <[email protected]> wrote in message
    news:[email protected]...
    >
    I am trying to create datasources dynamically. Using an example from aprevious
    post,
    mbeanHome = lookupMBeanHome();
    JDBCDataSourceMBean dsMBean =(JDBCDataSourceMBean)mbeanHome.createAdminMBean(poolName,"JDBCDataSource",
    mbeanHome.getDomainName());
    dsMBean.setJNDIName(poolName);
    dsMBean.setPoolName(poolName);
    dsMBean.addTarget(tserverMBean);
    dsMBean.setPersistenceEnabled(false);
    How can I retrieve the proper TargetMBean reference to send to theaddTarget method.
    >
    >
    Does anyone know where I can find an entire class example of dynamicallycreating
    datasources, or something similar.
    Thanks in advance,
    Fahd

  • MXML Dynamic Object Creation

    Hi ,
    Static Object Creation :
    Eg:
        <mx:Fade id="ViewStack_EffectStart" duration="500" alphaFrom="0.0" alphaTo="1.0"/>
        <mx:Fade id="ViewStack_EffectEnd" duration="500" alphaFrom="1.0" alphaTo="0.0"/>
    <comp:ErrorBox id="errorBox" active="{active}" showEffect="{ViewStack_EffectStart}" hideEffect="{ViewStack_EffectEnd}"/> .
    The above static objects is working fine, but the problem is that we have lot of similiar static object which creates a memory issue.If we create dynamic objects, will it avoid the issue.Is dynamic objects advisible?.
    Thanks in advance.Please reply ASAP.
    Thanks ,
    San.

    hmn.. I don't understand your questions fully.
    What about create the fade object in "Model" and reference the same Fade object for all dynamic objects?
    or r u asking to find out how to create fade in actionscript?
    var fade:Fade = new Fade();
    fade.target = this;
    fade.alphaFrom = 0;
    fade.alphaTo = 1;
    fade.play();
    hope this helps,
    BaBo,

  • Please help with dynamic menu creation needs to have 5 levels

    Hi,
    I have run into a Coldfusion problem that I was hoping you
    could help me with.
    What I am trying to solve is the dynamic creation of at least
    5 levels of categories for a menu built with Coldfusion, and if
    possible an infinite amount of levels.
    Each of these also if it is at the end of the tree will have
    to have products under it aswell the category will only show up if
    there is products under it.
    To acomplish this I have created a database table called
    "Categories" which contains the fields shown in the linked
    spreadsheet. I am using the "cat_parent" to hold the value of the
    parent of the current record. When the parent is a top level menu
    item I have assigned this a cat_parent id of "0". Using this method
    I am able to do a self join on the table (where "cat_parent" =
    "cat_id") to extract the relationship between parent and child
    records throughout the table. This works fine. And I have created
    output for 5 levels of display.
    There are 3 issues left that I could not work out.
    - Firstly my coding method loops through each node of the
    tree with one query to create each category of the menu. This means
    one query per menu category and as the client could have up to 200
    categories in the menu and I am concerned that the solution that I
    have come up with is too processor intensive.
    - Secondly the way that I have created the category menu is
    hard coding in the levels needed so there is only 5 not an infinite
    amount which would be preferable but is not essential.
    - Finally I could not work out how to not create "parents" in
    the tree if there is no products for the end child category.
    Meaning that if there is for example a category > subcategory
    > subsubcategory but there is no products associated with the
    end category - "subsubsubcategory" then it's parent and so on will
    not display until one of them has products.
    Here
    is a link to a zip file that includes: the cfc that contains
    the query function (categories.cfc), the page that is creating the
    categories menu (lefnav.cfm), a simple cfc that contains a products
    query just for testing (products.cfc) along with a spreadsheet of
    the Categories table's fields.
    I would greatly appreciate any suggestions.
    Thanks for any time and help you can give me on this

    This should at least get you started in the right direction.
    http://www.sitepoint.com/article/dynamic-menu-coldfusion
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technologies, Inc.
    =============================
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.macromedia.com/go/team
    "shunnyboy" <[email protected]> wrote in
    message
    news:e2h9hs$kp5$[email protected]..
    > Hi,
    >
    > I have run into a Coldfusion problem that I was hoping
    you could help me
    > with.
    >
    > What I am trying to solve is the dynamic creation of at
    least 5 levels of
    > categories for a menu built with Coldfusion, and if
    possible an infinite
    > amount
    > of levels.

  • Create a dynamic formula in Financial Reporting Studio

    Hello,
    this is my issue: i'd like to create a formula that reference dynamicly to a cell, so if i add a new row (and the first cell changes) i don't have to change the formula .
    Ex.
    formula: =cell[28,A] * 100
    if i add a row the cell[28,A] become [29,A] and the formula changes his value and i don't want it!
    i hope my request is quite clear.
    thanks for helping
    Andrea

    Hi
    Good question? I think, there is a solution.
    You can use the concept of multiple grid here.
    Please keep the referred grid at one place and use another grid where you want the formulas.
    Please mail me for further info: [email protected]

Maybe you are looking for

  • XSLT mapping errors

    Hi, I am tring to develope a senario with XSLT mapping. As part of this i have 1. Created Soruce and Target data types and message types 2. Created Inbound and outbound message interfaces 3. Imported both source and target messages types (XSD) files

  • Error while posting Travel advance

    Hi Experts, while posting travel expense to FI in PRRW i am getting following error. Post from posting run 0000000049 E RW609 Error in document: TRAVL 0000000052 AEDCLNT220 E F5354 Account 11301400 in company code 1000 cannot be directly posted to Po

  • How do I remove the battery when the battery release latch won't move?

    HPg71  laptop. Product VM114UA#ABA. Is there a service center I should know about in San Diego California?

  • Flash 8 install issue

    Ok I know everyone and their mother has changed over to 2000 windows OS. I and quite a few others have not and if at all possable will not. I still use 98 SE as my OS and would like to know if there is a 98SE compatable version so that I may view vid

  • TS1410 My macbook won't recognize my itouch.

    The last couple of weeks its been acting up, like for example I'd eject the itouch and it would be totally empty with no songs on it. now all of sudden it doesn't read my itouch at all!! help!