New-SpSite cmdlet with parameters list

Hi everyone !
In a PS script on a Sharepoint server, I'm trying to call a cmdlet with some arguments.
This is OK :
New-SpSite -url $url -owneralias $owneralias
However, I have the requirement to create a parameter list with arguments that sometimes are present, sometimes not. So I thought it was possible to create a string like this $Paramlist = "-url "+$url+" -owneralias "+$owneralias ... But It's not ok, PS give
me various errors.
What is the best method to construct a parameters list ?
TY for your assistance. Have a nice day.
J.

You can certainly create your parameter list - you will want to create a literal string of your parameters and then execute the command with the Invoke-Expression cmdlet. Literal strings are constructed with the single quote character. Take a look at this
article regarding how PowerShell processes strings -
http://www.computerperformance.co.uk/powershell/powershell_quotes.htm. If you don't use literal strings, then PowerShell will take your variables and produce the output in your $Paramlist variable which is not what you want when constructing the command,
especially if the variables contain any objects.
Example using a literal string and Invoke-Expression:
#... code to create variables (i.e. your $url and $owneralias variables)
$expression = 'New-SPSite -url $url -owneralias $owneralias'
$mySPSite = Invoke-Expression $expression
So simply construct a literal string, then execute it with Invoke-Expression. Give that a shot and let me know how you make out. I use this technique all the time when creating functions.
I hope this helps,
Craig
If someone on the forums takes the time to successfully address your question, please return the favour by marking their reply as helpful or as the answer to your question. Cheers.

Similar Messages

  • Error Using New-WebServiceProxy cmdlet with SQL Agent Powershell Subsystem

    I created a powershell script to connect to SSRS via web service so I can cache reports in the database and expose them directly through our application. The script works fine when I run it through Powershell directly, but when I try running it through the
    SQL Agent Powershell subsystem I am getting a strange error:
    "A job step received an error at line 61 in a PowerShell script. The corresponding line is '$RS = New-WebServiceProxy -Class 'RS' -Namespace 'RS' -Uri $reportServerURI -UseDefaultCredential  '. Correct the script and reschedule the job. The error
    information returned by PowerShell is: 'Could not load file or assembly 'file:///C:\WINDOWS\TEMP\yfqiivtg.dll' or one of its dependencies. The system cannot find the file specified.  '.  Process Exit Code -1.  The step failed."
    I am using SQL Server 2014, SSRS 2014, Windows 8.1. The only difference I can think of is that when I run Powershell from the OS, I am using v 4.0 whereas when I run it from SQL Agent it loads v 2.0. My understanding is that v 2.0 supports the New-WebServiceProxy
    cmdlet, so I'm not convinced the version discrepancy is the culprit. Any ideas what might be causing this?
    On a side note, is there a way to have SQL Agent use Powershell 4.0 for the subsystem? v 2.0 feels a little dated for SQL Server 2014.

    Hi WilliamW,
    When creating a PowerShell job step, there is only one security context available, which is the "SQL Server Agent Service Account." That means that if you intend to execute PowerShell scripts from SQL Agent Job steps, the SQL Server Agent
    service account must have appropriate permissions.
    According to your error message, I recommend to check if the SQL Server Agent service account has access to the folder where the scripts live, as well as the folder C:\WINDOWS\TEMP.
    In addition, when we execute a PowerShell job step in SQL Server, SQL Server Agent subsystem run the sqlps utility, and the sqlps utility launches PowerShell 2.0 and imports the sqlps module. If you need to run a PowerShell v4.0 script from a SQL Server
    Agent job, you can create a proxy account to run the agent job which contains PowerShell script. For more details, please review this similar blog:
    Run a PowerShell v3 Script From a SQL Server Agent Job.
    Thanks,
    Lydia Zhang

  • Enable data paging with parameters count() on new php function issue (BUG?)

    I've got my app prototyped quickly with the default settings in Flex Builder 4.  Now I'm going back and adding/modifying features to polish the app off.
    For this application I'm using PHP5 as the server side.
    The data paging is really cool and simple to call using the default settings.  However, I'm running into issues with customizing the data paging feature.
    This is the default header of the php function that was created for me:
    public function getTblbrowserrecord_paged($startIndex, $numItems){...}
    Instead of dumping all data back to the function I want to be able to search on certain fields so I created a new function called:
    getTblbrowserrecord_search_paged ($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems  ) {...}
    The new function is tested and operates as designed.
    I set the input types of the variables and return type (Tblbrowserrecord[]) of the new function then went to enable data paging.  The first screen came up and asked me for the key to use which I selected.  The next screen came up and asked me for the number of records which I set to 100 then went to select the count operation.
    I initially selected the automatically created count() function but it came up with the error " Count operation parameters should match the paged operation parameters list."
    So I created another function to match the search function's parameter's list:
    public function count_searched($szName, $szIP, $szRule, $szURL, $szDateLow, $szDateHigh, $szCode, $startIndex, $numItems)  {...}
    But I still ge the error "Count operation parameters should match the paged operation parameters list."
    But they DO match.  I looked at the default functions that were created by FB4 and noticed that the automatically generated function count() has no parameters and the paged function has the two functions $startIndex and $numItems which are not identical yet they work.  I tried removing those two fields from the count function but got the same results.
    What am I doing wrong?
    Thanks!

    Nevermind... For some reason my FB4 is not updating correctly.  After removing the two control fields at the end of the list AND exiting the app/re-entering everything worked ok.  I've been having this issue a lot lately and am thinking that is is a bug of some sort?

  • Adding a new Operating System to the list of OS'es returned with Get-SCOperatingSystem

    Is it possible to add a new Operating System to the list of OS'es that's returned by the Get-SCOperatingSystem PowerShell cmdlet?
    I have a few Linux distributions that will run fine under Hyper-V with the latest LIS improvements, but I would like to create a new entry for that said distributions as I would like it to display the correct name as the end-user is using Windows Azure Pack
    to access the virtual machines. 
    All posted advice may not be all that accurate. As always, test it in a lab before you try my advice! Best of all, the documentation is your friend.

    Never mind, I think I hacked up my own solution to the question:
    USE [VirtualManagerDB]
    GO
    INSERT INTO [dbo].[tbl_IL_OS]
    ([OSId]
    ,[Name]
    ,[Description]
    ,[Architecture]
    ,[OSFlags]
    ,[VMWareGuestId]
    ,[OSType])
    VALUES
    ('EBAB54C0-A9FA-4A3F-A21C-94775B96A6E5' /* Generate UUID */
    ,'Debian GNU/Linux 6 (64-bit)' /* Limited to 64 Chars */
    ,'Debian GNU/Linux 6 (64-bit)' /* Longer description of Linux Distro */
    ,'amd64' /* Use x86 for i386, amd64 for x86_64 */
    ,'28' /* This remains constant */
    ,'otherLinux64Guest' /* This is meant for VMware, go lookup the VMX spec files for this value */
    ,'1') /* Leave this at one, that's what the other OSes looked like */
    GO
    All posted advice may not be all that accurate. As always, test it in a lab before you try my advice! Best of all, the documentation is your friend.

  • List view - filter with parameters

    Hi,
    I need to define a list view to filter data with parameters.
    I saw how to do it with the SPD in another post
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/92271aa4-6582-4ea5-a10f-deaf02d2b62c/filtering-the-list-view-by-passing-date-parameters-using-sharepoint-desginer-2010?forum=sharepointcustomizationprevious
    But  need to do it in visual Studio (via definitins or Object Model).
    How can I do that in Visual Studio?
    Help is really appreciated.
    Many thanks,
    DD

    Hi,
    According to your description, you might want to create a list definition with the filter value from query string from URL. Then when you create a list instance with this list
    definition, you will be able to filter the list view page by appending parameters to the URL in the address bar.
    You can achieve this through modifying the Schema.xml file in the list definition project in Visual Studio like this:
    How to create custom list definition
    http://msdn.microsoft.com/en-us/library/office/gg276355(v=office.14).aspx
    http://www.codeproject.com/Articles/412429/SharePoint-Create-List-Definition-and-Instanc
    CAML Query Schema
    http://msdn.microsoft.com/en-us/library/office/ms467521(v=office.15).aspx
    Then we can filter the list with such an URL:
    http://sp/Lists/List1/AllItems.aspx?Param1=2014-08-24&Param2=2014-08-28
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • SSRS reporting with sharepoint list using Distinct and Multivalue parameters

    i want create ssrs report with sharepoint list using ms-vs(2008). i want create Distinct multivalue parameters by using CAML query. There is any way we put CAML query where we use Distinct keyword and IN clause in CAML query... i hope all experts will
    understand my poor English... sorry for poor English.. plz help me

    Hi AsifMehmood,
    Per my understanding you have create an SSRS report with SharePoint list, now you don’t know to create the distinct parameters by using CAML query,  right?
    For the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results, but we can use the custom code to do this function. I have tested on my local environment and we can do that by create one hidden parameter(Param1)
    to get all the values from the fields which will  add the filter and then create another parameter(Param2) to get the distinct values based on the Param1, we use the custom code to do the deduplication.
    Step by Steps information in below thread for your reference to create the parameters and the custom code:
    "How to get distinct values of sharepoint column using SSRS"
    Other similar thread for your reference:
    https://audministrator.wordpress.com/2014/02/17/sharepoint-list-add-distinct-parameter-value/
    If your problem still exists, please feel free to ask and also try to provide us more details information.
    Regards
    Vicky Liu

  • I have a new MacBook Pro with OS10.8.2 and cannot get Contacts to print a list of addresses with pictures showing.  There is a check box selecting "picture" which has been checked - but no picture.  This worked fine on OS10.7.5.  Problem??

    I have a new MacBook Pro with OS10.8.2 and cannot get Contacts to print a list of addresses with pictures showing.  There is a check box selecting "picture" which has been checked - but no picture.  This worked fine on OS10.7.5.  Problem??

    First, back up all data immediately, as your boot drive might be failing.
    There are a few other possible causes of generalized slow performance that you can rule out easily.
    Reset the System Management Controller.
    If you have many image or video files on the Desktop with preview icons, move them to another folder.
    If applicable, uncheck all boxes in the iCloud preference pane.
    Disconnect all non-essential wired peripherals and remove aftermarket expansion cards, if any.
    Check your keychains in Keychain Access for excessively duplicated items.
    If you have more than one user account, you must be logged in as an administrator to carry out this step.
    Launch the Console application in the same way you launched Activity Monitor. Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Select the 50 or so most recent entries in the log. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V). You're looking for entries at the end of the log, not at the beginning.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some personal information, such as your name, may appear in the log. Anonymize before posting. That should be easy to do if your extract is not too long.

  • Passing Multiple Selected List Items to a "New Item" Form in Another List with Multiselect Lookup Field

    Hi!
    Version Info:  SharePoint 2013 Server Standard (*BTW...I do not have access to Visual Studio*)
    I have two lists, let's call them
    -Assets
    -Asset Checkouts
    "Assets" is the parent list, and "Asset Checkouts" has a lookup column (multiselect) which is tied to the serial # column in the "Assets" list.
    Basically, what I need to accomplish is this:  I would like to be able to select multiple list items in the "Assets" list, and create a new item in "Asset Checkouts", and pre-fill the multiselect lookup column in the NewItem form
    for "Asset Checkouts" with the values from the selected items in "Assets".
    Any ideas or suggestions on how to do this would be most appreciated!
    Thanks!

    Hi,     
    According your description, you might want to add new item in "Asset Checkouts" list when selecting items in "Assets" list.
    If so, we can achieve it with SharePoint Client Object Model.
    We can add a button in the "Assets" list form page, when selecting items, we can take down the values of columns of the selected items, then click this button which will create
    new item in "Asset Checkouts" list with the values needed.
    Here are some links will provide more information about how to achieve it:
    Use
    SP.ListOperation.Selection.getSelectedItems() Method to get the list items being selected
    http://msdn.microsoft.com/en-us/library/ff409526(v=office.14).aspx
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
    Add ListItem with Lookup Field using Client Object Model (ECMA)
    http://notuserfriendly.wordpress.com/2013/03/14/add-listitem-with-lookup-field-using-client-object-model-ecma/
    Or if you just want to refer to the other columns in "Assets" list when add new item in "Asset Checkouts" list, we can insert the "Assets" list web part into the NewForm page
    of the "Asset Checkouts" list, then when we add new item in the "Asset Checkouts" list, we will be able to look through the "Assets" list before we select values for the Lookup column.
    To add web part into the NewForm.aspx, we need to find the button "Default New Form" from ribbon under "List" tab, then we can add web part in the NewForm.aspx.
    In the ribbon, click the button “Default New Form”:
    Then we can add web part into NewForm.aspx:
    Best regards
    Patrick Liang
    TechNet Community Support

  • Help with Defining a new Concurrent Program using Parameters

    I wrote a very simple sql script and I want to register it as an Oracle Concurrent Program. I included a parameter field in the sql script to allow the entry of value to determine the number of days prior for the script. The script runs successfully in SQL*Plus, but when I try to register it as an Oracle Concurrent Program I get the following errors below:
    This works in SQL* PLUS
    SELECT emp_id, amount
    FROM tblSalaries
    WHERE hire_date > SYSDATE-&Days;
    Enter value for Days: 7
    old    3: hire_date > SYSDATE-&Days
    new  3: hire_date > SYSDATE-7
    And it provides my results....Although when I register this as a concurrent program and assign the parameter in the setup, and run the concurrent program and enter the number in the parameter field, the job completes in ERROR with the following:
    Enter value for Days: EXEC FND_CONC_STAT.COLLECT;
    hire_date > SYSDATE-EXEC FND_CONC_STAT.COLLECT; and
    ERROR at line 3:
    ORA-00933: SQL command not properly ended If I put single quotes around '&Days', in line 3, I get a different error:
    ERROR at line 3:
    ORA-01722: invalid number Do you know what could be the problem?
    Thanks for reviewing!

    Duplicate post - Setup for Defined Concurrent Program with Parameters - SQL Script
    Srini

  • I cant sync iCal from my MacBook Pro to my iphone4 with new iphone (sync it's ok with contact list)

    I cant sync iCal from my MacBook Pro to my iphone4 with new iphone (sync it's ok with contact list, ....)

    Hey Charles
    Thanks for your reply. Unfurtunately is didnt work. I did follow the part with reseting Isync and so on... But it still doent sync my Iphone info to the Icalender. The problem is that if I reset/restore my Iphone
    I´ll loose a lot of important appointments and phone numbers. Can I restore it and the use the backup from Itunes - and will this fix the problem?
    Thank you for your help!
    Mikkel

  • Remove/hide "new item or edit this list" link of sharepoint online (office 365) with csom

    as title, I delevelop an app for sharepoint online, so I must use client api to operate sharepoint object. now, i need to remove/hide the link “new item or edit this list”, not use js do it, what can i do? help!!

    Hi,
    Per my understanding, you might want to remove the link “new item or edit this list” of a list view web part using Client Object Model.
    As there is no such property in
    WebPart object can be used to hide/remove the link, I suggest you apply custom CSS style to the page which contains the list view
    web part to hide it.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Download DRM Properties with Definition Details, Parameters, List Values, etc.

    Is there a way to download the list of all the properties, including the defintion attributes, formulas/parameters, list value, lookup tables, etc.?
    Thanks.

    Bill,
    Its there in the XML if you export it from the Migration client, but you won't like its format much .
    From DRM i don't think there is another way to do this.
    Thanks
    Denzz

  • An error The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered after launching a ps1 script from cmd file.

    I'm trying to load sharepoint script from *.cmd file. 
    I have Sharepoint 2010 installed on Windows 7 x64 and SQL server 2008r2.
    My cmd file is: 
    Powershell -v 2 -NonInteractive -NoLogo -File 1.ps1
    My sharepoint file 1.ps1 is:
    $snapin="Microsoft.SharePoint.PowerShell"
    if ($action -eq $null -or $action -eq '')
    {<br />
    # Action by default is complete uninstallation.
    $action='uninstall'
    $uninstall = $true
    else
    $action = $action.ToLower()
    switch($action)
    { $_ -eq "uninstall" } { $uninstall = $true; break }
    { $_ -eq "removesolution" } { $removeSolution = $true; break }
    { $_ -eq "deactivatecorpus" } { $deactivateCorpus = $true; break }
    { $_ -eq "deactivatesupport" } { $deactivateSupport = $true; break }
    default { Write-Host -f Red "Error: Invalid action: $action "; Exit -1 }
    Check the Sharepoint snapin availability.
    if (Get-PSSnapin $snapin -ea "silentlycontinue")
    Write-Host "PS snapin $snapin is loaded."
    elseif (Get-PSSnapin $snapin -registered -ea "silentlycontinue")
    Write-Host "PS snapin $snapin is registered."
    Add-PSSnapin $snapin
    Write-Host "PS snapin $snapin is loaded."
    else
    Write-Host -f Red "Error: PS snapin $snapin is not found."
    Exit -1
    $url = "http://pc1/sites/GroupWork/"
    $site= new-Object Microsoft.SharePoint.SPSite($url )
    $loc= [System.Int32]::Parse(1033)
    $templates= $site.GetWebTemplates($loc)
    foreach ($child in $templates){ write-host $child.Name " " $child.Title}<br />
    $site.Dispose()
    The script works fine from the Sharepoint 2010 management shell after launching the shell from the start menu (or from windows cmd by entering powershell -v 2):
    PS C:\2> .\1.ps1 
    PS snapin Microsoft.SharePoint.PowerShell is loaded.
    GLOBAL#0 Global template
    STS#0 Team Site
    STS#1 Blank Site
    STS#2 Document Workspace
    MPS#0 Basic Meeting Workspace
    MPS#1 Blank Meeting Workspace
    MPS#2 Decision Meeting Workspace
    MPS#3 Social Meeting Workspace
    MPS#4 Multipage Meeting Workspace
    CENTRALADMIN#0 Central Admin Site
    WIKI#0 Wiki Site
    BLOG#0 Blog
    SGS#0 Group Work Site
    TENANTADMIN#0 Tenant Admin Site
    {248A640A-AE86-42B7-90EC-45EC8618D6B4}#MySite2 MySite2
    {95629DC2-03B1-4C92-AD70-BC1FEAA49E7D}#MySite1 MySite1
    {7F01CFE4-F5E2-408B-AC87-E186D21F624C}#NewSiteTemplate NewSiteTemplate
    PS C:\2>
    I have an access to the database Sharepoint_Config from current domain user and from other 2 users. All users have db_owner rights to the Sharepoint_Config database. But
    i've loaded in windows from the user which is dbo in the database (dbo with windows authentication with domain\username for the current user). The dbo user has do_owner rights in the Sharepoint_Config database. I've tried to login under other users and launch
    the cmd file but without success.
    My PowerShell has version 2.0: 
    PS C:\2> $psversiontable
    Name Value
    CLRVersion 2.0.50727.5477
    BuildVersion 6.1.7601.17514
    PSVersion 2.0
    WSManStackVersion 2.0
    PSCompatibleVersions {1.0, 2.0}
    SerializationVersion 1.1.0.1
    PSRemotingProtocolVersion 2.1
    After launching the script from 1.cmd file i get an errors:
    C:\2>Powershell -v 2 -NonInteractive -NoLogo -File 1.ps1
    PS snapin Microsoft.SharePoint.PowerShell is registered.
    The local farm is not accessible. Cmdlets with FeatureDependencyId are not regis
    tered.
    Could not read the XML Configuration file in the folder CONFIG\PowerShell\Regist
    ration.
    Could not find a part of the path 'C:\2\CONFIG\PowerShell\Registration'.
    No xml configuration files loaded.
    Unable to register core product cmdlets.
    Could not read the Types files in the folder CONFIG\PowerShell\types.
    Could not find a part of the path 'C:\2\CONFIG\PowerShell\types'.
    "No Types files Found."
    Could not read the Format file in the folder CONFIG\PowerShell\format.
    Could not find a part of the path 'C:\2\CONFIG\PowerShell\format'.
    No Format files Found.
    PS snapin Microsoft.SharePoint.PowerShell is loaded.
    New-Object : Exception calling ".ctor" with "1" argument(s): "The Web applicati
    on at http://Pc1/sites/GroupWork/ could not be found. Verify t
    hat you have typed the URL correctly. If the URL should be serving existing con
    tent, the system administrator may need to add a new request URL mapping to the
    intended application."
    At C:\2\1.ps1:48 char:18
    + $site= new-Object <<<< Microsoft.SharePoint.SPSite($url )
    + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvoca
    tionException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.Power
    Shell.Commands.NewObjectCommand
    Please help me. I don't understand why the script is launched from the sharepoint management shell but doesn't work from the cmd file.

    I have an answer for my problem:  for solving a problem I've made several steps:
    1. Run farm installation under AD admin credentials - runas /user:Domain1\DomainAdmin1 "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\psconfigui.exe".
    This user has been added as farm administrator in the wizard.
    This user has been added as DBO in the SQL Server. (This is the main difference with my previous attempts)
    2. Execute a command Add-SPShellAdmin Domain1\UserAccount1 in
    the Management Shell of Sharepoint.
    3. Run SQL server and add Sharepoint_Shell_Access to the Domain1\UserAccount1
    (my main account) in the Config database
    4. Run CMD file only from Start->Run menu. 
    runas /user:Domain1\UserAccount1 "C:\1.cmd".
    Do not use Total Commander command prompt or file list for executing *.cmd of *.bat files without root administrator account.
    Thanks all for help.

  • How to create a view with parameters; read the documentation but nothing!

    Hello!
    I'm new to the Oracle world but together with my coworkers we need to very quickly study Oracle to figure out whether we'll add Oracle to our list of supported databases or not.
    Question: How do I create a view with parameters?
    I've read the documentation but I could not find this! I found the sql syntax to create a view but no parameters whatsoever...
    I have found on the web some very complicated way of doing this, but doesn't Oracle support Views with parameters?
    The goal here is to return a recordset, don't forget, so,please don't speak about stored procedures unless you are going to tell me how to get a recordset out of a stored procedure! ;)
    Thanks for all your help and attention!
    Jorge C.

    You can set up a parameterized view via context as follows:
    1. Set up a procedure to set your context values:
    create or replace procedure p_set_context (p_context IN VARCHAR2,p_param_name IN VARCHAR2,p_value IN VARCHAR2)
    as
    BEGIN
    sys.dbms_session.set_context(p_context,p_param_name,p_value);
    END;
    2. Create your context using the procedure you just created
    create or replace context my_ctx using p_set_context
    3. This is the test table I'll use
    create table my_table(col1 number)
    and populate it:
    begin
    for v_index in 1..10
    loop
    insert into my_table values(v_index);
    end loop;
    end;
    and the view that will be parameterised
    create or replace view v_my_table as select col1 from my_table where col1 between sys_context('my_ctx','start_range') and sys_context('my_ctx','end_range')
    4. Now set the parameters using the procedure above.
    begin
    p_set_context('my_ctx','start_range','1');
    p_set_context('my_ctx','end_range','5');
    end;
    5. Selecting from my_table will give you 1 to 10 (no surprise there :-) )
    selectng from v_my_table will give you 1 to 5
    You can use the context to set formats etc using the same principle. A common gotcha to watch for is trying to set the context directly using DBMS_SESSION.SET_CONTEXT instead of creating a procedure. This belongs to SYS and SYS won't have the privileges to set your context so you get an insufficient privileges result leading to much headscratching and unnecessary grants (at least that's my understanding of it).
    Sorry Jorge, as you're new to Oracle I should also have pointed out for completeness sake, that you can change the parameters at any time through recalling the p_set_context, for example, following on from above, after your "select * from v_my_table" and seeing 1 to 5, you could then do
    begin
    p_set_context('my_ctx','start_range','3');
    end;
    and when you requery 'Select * from v_my_table' you will now see rows 3 to 5.
    Bit of a simplistic example, but you can see how easy it is. :-)
    Message was edited by:
    ian512

  • Chart with parameters in SSRS 2012

    Hello,
      I want to do a chart (line chart particularly, but I will take an answer for any chart as they all probably work similarly) with one parameter passed (hospitalid) and two values returned (BedDays and MonthYear).  MonthYear is how the horizontal
    line is divided, by each month, and the BedDays should be the number of patient stays in beds in that month.  Doesn't matter if it's sum of bed days or bed days, because a sum is made in the stored procedure, and MonthYear is unique.
      I have spend a few days on this problem, working a lot on it, and I keep running into errors, trying various methods.  I don't know where all my errors could be coming from, it could be in the aspx, it could be in the report design, or it could
    be in the code behind, so I am hoping someone can give me a step by step solution to this problem which should be simple, but apparently is not because there is no worthwhile help that I can find on the internet.  It should work for SSRS 2012, I do not
    have a choice of using an earlier version for this project.  Please include everything I need to do in the report GUI, in the aspx file, and in the code behind, as any little error in any of these could keep this from working and make it very difficult
    for me to pinpoint what is going wrong.
      Please help!

    I'm using Visual Studio 2013.  According to what I read, there is no report preview in newer versions?
    I created a report and then added a line chart.
    I used my connection and under Data Set Name I put: AllevantReportDataSetB
    Under Choose the Dataset, I selected AllevantReportDataSetB as the data source. 
    For "Name" I chose DataSetB
    The stored procedure works (that is all you need to know, because the inner detail shouldn't make a difference), and when a parameter @facilityid is passed to it, it returns a table with the first column named MonthYear which is a date of all of the months,
    years, and the first of each month from the beginning to end of the data - and the second column is BedDays, the number of total stays in a bed for all of the patients at the facility.
    In Category groups, I have MonthYear, and in Values I have BedDays (actually [Sum(BedDays)], but the sum shouldn't matter, because the MonthYears are unique so there is only one MonthYear, there is not more than one of the same month in the whole data set)
    My .aspx is the following:
    <rsweb:ReportViewer ID="ReportViewer1"
    runat="server"
    ProcessingMode="Remote"
    Font-Names="Verdana"
    Font-Size="8pt"
    InteractiveDeviceInfos="(Collection)"
    WaitMessageFont-Names="Verdana"
    WaitMessageFont-Size="14pt"
    Width="95%"
    Height="99%" ShowDocumentMapButton="False"
    ShowPromptAreaButton="False" Visible="true">
    <LocalReport ReportEmbeddedResource="MySolution.Report5.rdlc">
    <DataSources>
    <rsweb:ReportDataSource DataSourceId="Report1DataSource" Name="DataSetB" />
    </DataSources>
    </LocalReport>
    </rsweb:ReportViewer>
    And my VB code behind is the following:
    Protected Function GetReportDataTable() As DataTable
    Dim Conn As New SqlConnection(ConfigurationManager.ConnectionStrings("sql").ToString)
    Dim Command As New SqlCommand("BedDays", Conn)
    Dim BedDaysDataTable As New DataTable()
    BedDaysDataTable.Columns.Add("MonthYear", GetType(DateTime))
    BedDaysDataTable.Columns.Add("BedDays", GetType(Int32))
    Command.CommandType = CommandType.StoredProcedure
    Command.Parameters.Add("@facID", SqlDbType.Int).Value = 20
    Command.Connection = Conn
    Conn.Open()
    Dim DataReader As SqlDataReader = Command.ExecuteReader()
    BedDaysDataTable.Load(DataReader)
    Conn.Close()
    Return BedDaysDataTable
    End Function
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
    FillMetricsDDL()
    FillFacilityDDL()
    Dim rds As ReportDataSource
    rds = New ReportDataSource("Report1DataSource", GetReportDataTable)
    Dim ReportParameters As New List(Of ReportParameter)
    ReportParameters.Add(New ReportParameter("@facID", 20))
    ReportViewer1.LocalReport.DataSources.Add(rds)
    ReportViewer1.LocalReport.ReportPath = "Report5.rdlc"
    ReportViewer1.LocalReport.Refresh()
    End If
    Common.Chosen(Me)
    End Sub
      I am getting the error where the report should be
    Unable to connect to the remote server, no connection could be made because the target machine actively refused it.                                        
    But I suppose once this error is resolved, there will be more, because I really do not quite know exactly how SSRS charts with parameters in SSRS 2012 are suppossed to work, in code behind, in aspx, and in the charting, and how it all ties together.  So
    some complete guidance to show ALL the places where I am going wrong here would be much appreciated, not just an attempt to solve the one error I have above, which may not be the sum total of all of my problems here.
    Unless, of course, it IS the only error which would be GREAT.

Maybe you are looking for

  • Text Variable Not Refreshed

    Hello, I created a data text variable user exit. everyting works fine, but, 1) Selection options: Year: 2010 Month: 1 to 11 The query and text variable return right values Year 2010 Month: Jan to Nov but, if i want to make new selection 2) Year : 201

  • Can't make "Back to my mac" work for me.

    Hello world I tried everything! Set routers on UPnP. Updated Firmware. Enabeld sharing. Logged out an in .Mac on all my Computers (same .Mac-account). Nothing! B2MM just won't work. Home mac doesn't show up on office mac and the other way round. I'll

  • Dynamic PDF field value doesn't display XFDF value when no keyboard focus

    I created a simple PDF (test.pdf) file (one text field), and saved it as a "static PDF". I created a XFDF file, and when I double-click on the XFDF file, the sample PDF opens and the field is populated. Here's the problem: I save test.pdf as a "dynam

  • Increments Of 100 With Grad Filter and Adj Brush Using Scroll Wheel and Arrows

    For Vista 64 bit and Nvidia GeForce 8500 GT driver version 7.15.11.6960, both the graduated filter and adjustment brush change at increments of 100 or 200 using the scroll wheel or arrows for everything except exposure. Brightness goes from -200 to 0

  • Bug in Project 2013 when turning off screenupdating in vb

    Below a short (3-line) piece of code that turns off screen updating, applies the "Gantt Chart" view (though any view or table produces the same effect), then turns screen updating on again. When you run the code, the result is all task names and gant