Dynamic Parameters in Powershell

Hello,How can I achieve this in powershellusing System;
class Program
static void Main()
int sum1 = SumParameters(1);
int sum2 = SumParameters(1, 2);
int sum3 = SumParameters(3, 3, 3);
int sum4 = SumParameters(2, 2, 2, 2);
Console.WriteLine(sum1);
Console.WriteLine(sum2);
Console.WriteLine(sum3);
Console.WriteLine(sum4);
static int SumParameters(params int[] values)
int total = 0;
foreach (int value in values)
total += value;
return total;
}Output
1
3
9
8

Thanks for your reply.
With out invoking C# code,  Can I directly write this function in power shell 
static int SumParameters(params int[] values){
int total = 0;
foreach (int value in values){
total += value;
return total;
And passing parameters 
SumParameters 1
SumParameters 1 2  
SumParameters 1 2 3  

Similar Messages

  • Crystal Reports Dynamic Parameters with SAP Business One

    Okay, I've got this very strange issue with dynamic parameters in Crystal Reports connected to SAP Business One.
    Let's start with the software versions:
    - Crystal Reports 12.3.0.601
    - SAP Business One 8.8 (8.80.231) SP: 00 PL: 13
    - Windows XP SP3
    (SBO Server on Windows 2003 and SQL 2005)
    What I'm about to describe is something I've tried in several reports and for which I created a very, very simple test report to see if it was reproducible in a very simple situation.
    - I connected to a Business One server through CR's SBO connection type. Logon is successful, tables are shown.
    - I pick OCRD and plac CardCode and CardName in the details section on the report. Previewing the report shows data.
    - I create a dynamic parameter on CardCode and in the Select Expert I select the CardCode field and define that that should be equal to the parameter.
    - I preview the report again. Now it asks me in such a parameter screen for logon credentials. It shows the server and database it tries to connect to and in the username it shows the SQL Server username I used to connect to the SQL Server in the first place. However, the password for that user is not accepted. I also tried to login with the Windows administrator user and with the SBO manager user, but no success with any attempt.
    I also tried to add a static parameter and add all database values to the list. Same screen, different result:
    Crystal Reports 2008 wrote:
    Logon Failed.
    Error in File UNKNOWN.RPT:
    Unable to connect: incorrect log on parameters. (rptcontrollers.dll)
    (On a side note: the report is saved as report1.rpt)
    Anyone else got similar issues and found a solution?

    Hi,
    When you have fixed your crystal installation following the note posted earlier, please take a look at the [how to guide|http://service.sap.com/sapidb/011000358700000882232009E.pdf] and also at the [e-learning|http://service.sap.com/sapidb/011000358700001370262010E] about SAP Business One 8.8 and Crystal Reports.
    There are so called "tokens" which you need to use instead of dynamic parameters.
    Dynamic paramters don't work in SAP Business One 8.8, if they are not defined as a static paramter with token.
    Best regards,
    Darius

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • Crystal Report Viewer Credential Prompt for Report with Dynamic Parameters

    The .NET Crystal Report Viewer is prompting for database credentials when launching a report containing dynamic parameters. This only occurs for reports created with SAP Crystal Reports 2011 designer. Reports created with Crystal Reports XI designer (where dynamic parameters were first introduced) work correctly.
    The credential prompt window contains the following fields:
    - Server Name: <server name> (disabled)
    - Database Name: <database name> (disabled)
    - User Name: <empty> (enabled)
    - Password: <empty> (enabled)
    - Use Single Signon Key: false (disabled)
    The values in the prompt window which are disabled are the database connection values used during the design of the report in the SAP Crystal Reports 2011 designer.
    Expected Result:
    - No prompt for database credentials.
    - Values read from the database should be populated in a drop down for the dynamic parameters.
    Environment:
    - Visual Studio 2010 (C#)
    - Windows 7 Enterprise
    - SAP Crystal Reports runtime engine for .NET Framework 4
    - SAP Crystal Reports, version for Visual Studio 2010
    - SAP Crystal Reports 2011
    The database connection is being set to use a DSN. It must be a DSN as the calling application is only aware of the DSN/Username/Password values. These values are being passed to the Crystal Report Viewer contained in a Windows form.
    The database connection for the report is being set as follows:
    foreach (InternalConnectionInfo internalConnectionInfo in this.report.DataSourceConnections)
        // Must set the UseDSNProperties flag to True before setting the database connection otherwise the connection does not work
        if (internalConnectionInfo.LogonProperties.ContainsKey("UseDSNProperties"))
            internalConnectionInfo.LogonProperties.Set("UseDSNProperties", true);
        // Supposed to set the database connection for all objects in the report (ie. main report, tables, sub reports)
        internalConnectionInfo.SetConnection(this.DSN, string.Empty, this.LoginName, this.Password);
    The SetConnection method's signature is as follows:
       SetConnection(string server, string database, string name, string password)
    As you can see from the code snippet above I am setting the DSN name as the server parameter, blank for the database parameter (a database connection using DSN should only require DSN name/Username/Password) and the database username and password respectively.
    Is this a SAP bug?
    Is this the correct way of setting the database connection to use a DSN?
    Is there some other properties that need to be set somewhere else in the report through code?
    Any help would be greatly appreciated.

    Thanks for the pointer to the database connection code generator. After taking a look at the output from the tool I was able to finally get the dynamic parameters to load and populate properly without prompting for credentials. I needed to tweak the outputted code a bit to match my requirements of using a DSN only connection.
    Instead of updating the database connection properties contained within the Report.Database.Tables collection from the CrystalReports.Engine namespace, I changed it to replace the database connection properties in the Report.ReportClientDocument.DatabaseController.Database.Tables collection from the CrystalDecisions.ReportAppServer.DataDefModel namespace. For one reason or another, using the RAS namespace solved the problem.
    Below is the updated code with the change made:
    using RAPTable = CrystalDecisions.ReportAppServer.DataDefModel.Table;
    foreach (InternalConnectionInfo internalConnectionInfo in this.report.DataSourceConnections)
        // Must set the UseDSNProperties flag to True before setting the database connection
        if (internalConnectionInfo.LogonProperties.ContainsKey("UseDSNProperties"))
            internalConnectionInfo.LogonProperties.Set("UseDSNProperties", true);
        // Sets the database connection for all objects in the report (ie. main report, tables, sub reports)
        internalConnectionInfo.SetConnection(this.DSN, string.Empty, this.LoginName, this.Password);
    // The attributes for the QE_LogonProperties which is part of the main property bag
    PropertyBag innerPropertyBag = new PropertyBag();
    innerPropertyBag.Add("DSN", this.DSN);
    innerPropertyBag.Add("UserID", this.LoginName);
    innerPropertyBag.Add("Password", this.Password);
    innerPropertyBag.Add("UseDSNProperties", "true");
    // The attributes collection of the tables ConnectionInfo object
    PropertyBag mainPropertyBag = new PropertyBag();
    mainPropertyBag.Add("Database DLL", "crdb_ado.dll");
    mainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
    mainPropertyBag.Add("QE_LogonProperties", innerPropertyBag);
    // Pass the database properties to a connection info object
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.Attributes = mainPropertyBag;
    connectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
    connectionInfo.UserName = this.LoginName;
    connectionInfo.Password = this.Password;
    // Replace the database connection properties of each table in the report
    foreach (RAPTable oldTable in this.report.ReportClientDocument.DatabaseController.Database.Tables)
        RAPTable table = new RAPTable();
        table.ConnectionInfo = connectionInfo;
        table.Name = oldTable.Name;
        table.QualifiedName = oldTable.QualifiedName;
        table.Alias = oldTable.Alias;
        this.report.ReportClientDocument.DatabaseController.SetTableLocation(oldTable, table);
    this.report.VerifyDatabase();
    Thanks again Ludek for the help.

  • How to schedule a report with dynamic parameters

    We need to schedule a Webi report with dynamic parameters then email the different result to different email groups.  Is it possible to do this in scheduler? Please advise. Thanks.

    there are 2 schedulers
    1st  CMS
    the reports which does not have any input parameters, only then t can be scheduled in CMS
    2nd in Infoview
    if report has input parameters and if you want to schedule it, then you may need to schedule the report from Infoview
    To have a email notification
    configure the SMTP server in report JOB Server
    Thanks,
    Ganesh

  • ABAP WebDynpro app calling Transaction iview with Dynamic Parameters..?

    Good day!
    I need to code a call to a transaction (with dynamic parameters) from an Abap WD application.  It appears that to achieve this, the app needs to call a new portal transaction iview, passing the parameters in the call..? 
    This should ideally be via a Sapgui for Windows, but Html also an option (does it matter with regards to the method used?). 
    Kindly assist with advise/instructions, idealy with sample code extract to illustrate (new to Abap WD)...
    Kind regards
    j

    Hi
    this will help you doing so
    http://help.sap.com/saphelp_nw04s/helpdata/en/18/f96f4132f15c58e10000000a1550b0/frameset.htm
    Use BUSINESS_PARAMETERS to pass the data
    Abhi

  • How to have dynamic parameters with nonstandard taglib with JSTL

    Hello, I am using webwork 2.2.7, tomcat 4.1 (I have a java 1.4 requirement unfortunately), and jakarta-taglibs-standard-1.0.6 and some nonstandard taglibs and need to pass dynamic parameters to the nonstandard taglibs.
    I can see that the standard taglibs handle the ${foo} syntax for attributes but the nonstandard taglib is just getting set with "${foo}". I really need to set attributes of the nonstandard taglib with dynamic parameters. Is there some combination of c:set and the <%= syntax that can work?
    I have tried the following which does not work:
    <input:selectBox options="${accounts}"/> <!-- the nonstandard taglib just has the options property set as the literal string "${accounts}" -->
    I was thinking something like the following might work but it doesn't
    <c:set var="accounts" value="${accounts}"/> <!-- the core taglibs can deal with ${accounts} appropriately -->
    <input:selectBox options="<%=accounts=%>"/>
    I don't care how but I need to somehow access ${accounts} and set that Collection as an attribute of the taglib. Can anyone please help me solve this problem? Thank you very much.
    This is related to this thread: http://forums.sun.com/thread.jspa?threadID=5389311&tstart=0
    Joe.

    Discussion continued in [the original thread|http://forums.sun.com/thread.jspa?threadID=5389311&tstart=0].
    May as well keep it all together.

  • How to query repository to determine Dynamic parameters used by a report

    Using BOXI 3.1 SP3
    Windows 2008
    .NET
    SQL 2008 Database
    I would like to query the repository to figure out which report is using which a dynamic parameter and then to figure out the name of that dynamic paremeter.
    The issue is the when I publish a report with Dynamic Paremeters from CR2008 to BOXI, BOXI will automatically create all the underlying connections and also rename the parameters if there is a duplicate.  I have a situation where there were over 100 +reports published and thru repository explorer in CR2008, it's impossible to tell which parameter belongs to which report.
    I would like to find in the repository the name of the dynamic parameters being used by the report.
    If I query CI_INFOOBJECTS, it does have the prompts and the original name (SI_NAME).  I don't know if it's possible thru Query Builder to query and find this result, or whether I need to write some .NET code.  The only hint in CI_INFOOBJECTS that a report has dynamic parameter is thru SI_GROUP_ID = eor://HOECRS02.NA.XOM.COM:6400/AVDGc3Df_G5Ej9HoJqO3V2g
    All dynamic parameters have SI_GROUP_ID populated.....but not sure how to use this unique value AVDGc3Df_G5Ej9HoJqO3V2g  which appears to be a SI_CUID but not sure what to query next to get more information.
    If anyone has a query built already or some code to point me in the right directiion, that would be greatly appreciated.

    The best way to determine what your wattage draw is is to purchase a killawatt meter. They are relatively inexpensive (20-30 bucks).
    http://www.amazon.com/P3-International-P4400-Electricity-Monitor/dp/B00009MDBU/r ef=pdbbs_sr1?ie=UTF8&s=hi&qid=1209640995&sr=8-1
    Glor

  • Scheduling Repot in InfoView - Dynamic Parameters.....

    If I have some parameters set as dynamic and I try to schedule the report through InfoView....the login prompt appears.  I do not want my users to have to log in ever.
    I have the database configuration set - To Use original database logon information from the report and To Use same database logon as when report is run.  When I view a report on-demand I don't get the prompt.
    Does anyone know how I prevent the login prompt from appearing when a report is scheduled and has dynamic parameters?  We do not want our users to have SQL id's to the database - only Infoview logins.
    Thanks in advance for your help!

    Hi Lisa,
    When you create a dynamic prompt in Crystal and save the report to enterprise a business view will be created in the repository automatically. This Business View will have a datasource associated with it (used to connect to and obtain the dynamic list of params from the DB).
    It is on this datasource that you need to manually code the login details and select do not prompt at runtime. You can do this by using the Business View Manager Tool. Best practise for managed reports is to create your dynamic lists first in Business View Manager not Crystal and then present these to your report developers - this will give you some central control over the lists.
    See Crystal Reports user guide/Business View administrator guide.
    Hope this helps.
    James

  • Calling DB2 Stored procedure(with parameters) from powershell

    Hi 
    I am trying to call a DB2 stored procedure that has parameters from Powershell scrip and I am not able to can some one help me here?
    $ServerName = 'XXXX'
    $dbalias='XXXXX'
     $conn_string = "Provider=IBMDADB2;DBALIAS=$dbalias;Uid=;Pwd=;"
     $conn = new-Object system.data.Oledb.OleDbconnection
     $conn.ConnectionString = $conn_string
     $conn.open()
     $query="CALL DBID_CONTROL.GET_TABLE_MAINT_CTL(?,?,?,'MSAS','DATABASE_CONNECTIONS_CUBE','CUBE_PARTITION');"
     $cmd = new-Object system.data.Oledb.OleDbcommand($query,$conn)
      $ds=New-Object system.Data.DataSet
     $da=New-Object System.Data.OleDb.OleDbDataAdapter($cmd)
      $da.Fill($ds) [int]$cur_utc_date_key = $ds.Tables[0].Rows[0][0]
     $cur_utc_date          = $ds.Tables[0].Rows[0][1]
     ###list current date key & current date values
     write-output "current date key value is $cur_utc_date_key"
     write-output "current date value is $cur_utc_date"
     write-output " "
    Thanks

    Hi 
    This is the error message i get when i run the script
    Exception calling "Fill" with "1" argument(s): " CLI0100E  Wrong number of parameters. SQLSTATE=07001"
    At line:45 char:10
    +  $da.Fill <<<< ($ds)
        + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : DotNetMethodException

  • Last value in hierarchy of Dynamic parameters is not working in BO CMC

    I have a crystal report with dynamic parameters up to 4 levels (Hierarchy of 4 levels) that is developed on version 12.3.0.601 which is working fine on my system... But when the same was uploaded on Business Objects Central Management Console version is 3.1x first 3 hierarchies are populating fine but when comes to 4th hierarchy I am only getting the values that are linked to First Value of 2nd hierarchy.
    Example:
    If I take the example of the organization following is the hierarchy.
    1st : business head  // One Value
    2nd : Project head  // 4 values (p1,p2,p3,p4)
    3rd : Team head     // 1 value
    4th:  developer       // 2 values for every project head  that means total of 8 values.
    If 2nd hierarchy is p1,p2,p3,p4 then I am getting only 2 values of P1, In the same way if 2nd hierachy is p2,p1,p3,p4 then I am getting only 2 values that is of P2... but in real I need to total of 8 values because of all 4 parameters are selected at run time in 2nd level of hierarchy.
    I have tried all possible combinations of dynamic paramters but nothing was working for me...
    Problem is only in Business Objects CMC where the dynamic parameter is prompt is wrong in dev system everything is correct.
    Experts please help me in this.. I hope I have explained it clear... If not please let me know will provide more information.
    Thanks for your time.
    Siva
    Message was edited by: siva kumar

    " there are more than 170 similar list of values as _1, _2..._170"
    That's what happens when you build your prompts in the report and chose "update the repository" every time you save it to BO.
    For the future, you have a couple of options for initially creating dynamic prompts:
    1.  Create them directly in the BVM (all of the various pieces...)
    2.  Create them in Crystal, publish them to the repository only the first time you save the report, and then use the BVM for any maintenance.
    3.  Create a "dummy" report that just has in it the data you need for a single dynamic prompt.  Then create a dynamic parameter in the report based on that prompt.  Save it to your favorites folder, making sure that you update the repository so that the LOV gets created.  Again, use the BVM for any maintenance. (My personal favorite way to do these...)
    For options 2 and 3, a _DC will be created each time you update the repository.  However, best practice is to have a single "common" _DC for each database you connect to.  So, after saving the LOV you would then open the BVM, modify the _DF so that is points to the correct "common" _DC and then delete the new _DC.
    What I would do in your current situation depends on how many reports you have that access the same type of dynamic parameter.  If you have one or just a few reports using this same 4-level hierarchy prompts, I would do the following:
    1.  Delete all but the first set of BVM objects for the LOV (the ones without any numbers on the end).
    2.  Edit this set of BVM objects so that it has all of the information you're looking for.
    3.  Edit each report and set the dynamic parameter to point to this single LOV.
    If you have more reports than you can comfortable edit right now, I would still modify the first set of BVM objects to set them up as the common LOV.  Then you can do this:
    1.  As you edit each report, log on to the repository (on the File menu or in the Repository Explorer).
    2.  Edit the parameter and determine which set of objects it's pointing to.
    3.  Point the parameter to the common LOV.
    4.  Open the BVM and delete the set of objects that you found in step 2.
    -Dell

  • Published report requesting DB Login for Dynamic Parameters - V2008

    I have a report that is setup as a main report with many sub-reports. The Main report request a set of parameters all are dynamic and 4 are cascading. The sub-reports access one of 2 database connections and the dynamic paramters come from only one of those.
    It works fine in design mode and asks for the DB Credentials only once, but when I published it (Crystal Reports Server 2008) and I set the default DB Configurations (I make sure the Use same database logon as when report is run is checked) , it still prompts for the DB Login in InfoView when you go to View the report, but only the connection for the dynamic parameters.
    Have I just totally confused Crystal or is there a setting I am missing.
    Thanks,

    Bumping this to the top since I have not received any replies.

  • Using JOIN Function with NULL Dynamic Parameters

    I have a report with utilizes dynamic parameters but will not run if any of the parameters are null.  I am also using the JOIN function to print out the values of these parameters. If the user doesn't enter in all the parameters, can the report still run?

    Hi eburton 
    In CR 2008 we have optional parameter functionality, this will allow the report to run without parameter values.
    If you are not using CR2008 then the functionality is not available.
    Thanks,
    Sastry

  • Calling APEX form with dynamic parameters from Oracle Apps 11.5.8

    I have successfully managed to setup access to APEX forms from Oracle Apps 11.5.8 menus utilising Form Functions passing a number of hardcoded parameter values as outlined in the document, http://www.oracle.com/technology/products/database/application_express/pdf/Extend_Oracle_Applications_11i.pdf.
    I am now trying to ZOOM from an Oracle Form passing values of form items (dynamic parameters) to an APEX form. I have so far not been able to do this.
    I've also tried using;
    web.show_document('http://derep.obup.co.uk:4657/pls/apex/f?p=100:1::::::p1_cust_account_id:'||name_in('ast_cu_act.account_id')||':', '_TOP');
    but this prompts for a username/password again as this bypasses the APEX Launch process that is defined in my Form Function.
    Is this possible in the parameters section of Form Functions? or elsewhere.
    Regards,
    Naeem

    Hi Daan
    We do havea couple of customers doing this, they have taken two approaches:
    1. Install XMLP on a separate server entirely - kick off conc request to extract data and then use Java Messaging Service (JMS) to push the resulting XML to the external server where they are using AQ to set up jobs for the XMLP server to work through, generating and delivering the final documents.
    2. Set XMLP up as a virtual printer - here the conc request again generates XML but this time the result is directed to a virtual printer namely XMLP. There is a perl or similar wrapper that gets called as the printer and accepts the data, template, output format and delivery destination as parameters.
    Apologies for the 10,000 feet overview, hope it helps. Tim

  • Problems using Dynamic parameters with Crystal Reports and SBO 8.8

    Has anyone been able to successfully use a dynamic parameter in Crystal Reports with 8.8 using the Business One connector? When we try we get an additional logon to the database that pops up and the logon fails.
    We need this because we want to return live lists of PO documents from the server for selection. We are also trying to use nested dynamic parameters, because we want to first return the PO document based on the PO number, and then chose specific rows based on a field value in POR1.
    It works if we don't use the Business One connector, but then the report doesn't function properly inside of SAP.
    Any ideas would be appreciated.

    I have tried using tokens but they are too simple. I need something like a subselect where you first select one value and then another that is a subset of those values. Apparently the tokens can't even use a "where" clause.
    SAP dances around Dynamic parameters, but won't come out and say that they can't be used with the B1 connector. If that is the case then they should just say so and stop wasting our time. Apparently Crystal is not truely interfaced with B1, just sort of hanging out with it.
    I don't really care other than I have to do this select, subselect. If someone has a way to do that with tokens I would love to hear it.
    Thanks,
    Roy

Maybe you are looking for

  • SPEED TEST: 10.0.2 faster than 10.0.3

    After a couple of weeks battering my brain switching between two identical systems with one running 10.0.2 and the other 10.0.3, I decided to do a side-by-side comparion. To my (not really) surprise, 10.0.2 was much FASTER and less beachballing than

  • Group 2 monitors together in a 3 monitor display

    I am running 3 monitors (2x 1600x900 and 1x 1280x1024). I am using Windows 7 Enterprise. The PC I RDP into is a windows XP virtual PC with only 1 display. What I want is to setup the RDP to span the 2x 1600x900s - I can do so only by entering in a cu

  • How do I prevent copying BG colour when I paste?

    Copy a piece of text that sits on a colored background (let's say non -white) can't paste it onto a different colored background bc the colored background will paste with it Like above is there a fix or a setting that will prevent this copying the bg

  • "Send to SpeedGrade" doesn't... do... anything...

    Hello -  I have been trying to get my project out of Premiere and eventually into DaVinci for grading. An Adobe rep suggested going to SpeedGrade, then saving an XML from there (in order to preserve nested sequences and merged clips).  I have not bee

  • I need to talk to a Supervisor.........

    We have been dealing with a third party Verizon store since September 22, 2014.... My husband still has not receives his 6+ 64 gold iphone. I ordered it tonight with a very qualified Represenative, Aleah. My concern is, when we originally ordered the