Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


SSRS, how to let the user manually input the value in a table (not by the parameter method)

Posted on 2016-07-20
Medium Priority
Last Modified: 2016-07-22
hi Experts,

The user wants to manually input the business contract No. up to 50 in table A. Table B will be called based on how many business contract no. was input in table A. For example, If the user input 5 business contract no. in table A,  then the table B will show the related data for those 5 business contract no.

We do not want to do it by parameter, since 50 is too much.

Thank you,
Question by:tanj1035
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 13

Accepted Solution

Arifhusen Ansari earned 2000 total points
ID: 41722173
In ssrs i think you have to use parameter if you want your user to provide input.

If  you think that 50 is too much to provide the separate parameters then you can provide the single text box parameter. Your user can manually provide the data in comma separated way.

You can use that string and split it in the form of table using custom split function. If you want this approach then just let me know, it will post the code for split function

Author Comment

ID: 41723309
hi Arif, Thanks for your reply. If I do the function split & parameter approach.
I have encounter the issues.  The stored procedure only returned the top 4 rows of data. If I input 5 contract strings or 50 contract strings, it only returned top 4 contract string data. Do you have any suggestions? Thank you.

The data type of contract strings is varchar.  They are displayed as
Contract String

Those are my code below

CREATE  FUNCTION [dbo].[Split]
	@List nvarchar(2000),
	@SplitOn nvarchar(5)
RETURNS @RtnValue table 
	Id int identity(1,1),
	Value nvarchar(100)

While (Charindex(@SplitOn,@List)>0)
Insert Into @RtnValue (value)
    Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1))) 
Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))
Insert Into @RtnValue (Value)
    Select Value = ltrim(rtrim(@List))



Open in new window

create procedure [dbo].[sp_rept_TitleLoan_AuctionSalesSummaryByContract]
@Contract varchar(50)
Created by:            Joy Tan
Created on:            7/20/2016
Description:      For the report Auction Sales Summary By Contract





--declare @ReportDate datetime
--Set @ReportDate=DateAdd(d,-1,Convert(char(10),GETDATE(), 101))

SELECT StoreName,VendorName, LoanStoreID,ContractString,CustomerLastName + ', '+ CustomerFirstName as CustomerName,AuctionLetterExpDate,AuctionDate,LoanAmountFinanced,OPB,
      ISNULL(AutomobileBlackBookValue,0) AS BBV,AuctionSaleAmount,RepoFee,(AuctionExpense+AuctionMiscExpense) AS OtherExpenses,
      AuctionCheckAmount,(AuctionCheckAmount-RepoFee) AS GainLoss,AuctionDisposalDate,VPName,AMName

SELECT StoreName, LoanStoreID,ContractString,CustomerFirstName,CustomerLastName,AuctionLetterExpDate,AuctionDate,LoanAmountFinanced
,case when VendorName is null then 'Not Entered' else vendorname end  as VendorName,
            (SELECT SUM(TransactionPrincPaid) FROM tblReportingTransactions WHERE tblLoans.LoanID=tblReportingTransactions.LoanID AND TransactionDate>=tblLoans.AuctionDate AND TransactionTypeID IN (1,2,3,9,11)) AS OPB,
            tblVP.UserFirstName+' '+tblVP.UserLastName AS VPName,tblAM.UserFirstName+' '+tblAM.UserLastName AS AMName, AuctionDisposalDate
      FROM tblvendors tblvendors right join
          tblLoans tblloans on tblvendors. vendorid= tblloans.auctionvendorid INNER JOIN
            tblCustomers ON tblLoans.CustomerID=tblCustomers.CustomerID INNER JOIN
            tblAutomobiles ON tblLoans.AssetID=tblAutomobiles.AssetID INNER JOIN
            tblStores ON tblLoans.LoanStoreID=tblStores.StoreID INNER JOIN
            tblUsers tblVP ON tblStores.vpID=tblVP.UserID INNER JOIN
            tblUsers tblAM ON tblStores.amID=tblAM.UserID
            AND LoanStatusID=2
            AND  CONTRACTSTRING  IN (select value from [dbo].[Split] (@Contract, ','))
ORDER BY VPName,AMName, LoanStoreID



exec sp_rept_TitleLoan_AuctionSalesSummaryByContract

Open in new window


Author Comment

ID: 41723437
I have changed @Contract varchar(50) to @Contract varchar(max). It can return me 46 rows, but still not 50 rows.  Does (max) still have limitation?

LVL 13

Expert Comment

by:Arifhusen Ansari
ID: 41724133
You query might return the max 46 record only.

Try to run the query with out @Contract filter. So you come to know how number of rows are available.

Author Comment

ID: 41725181
What I changed

@Contract varchar(50) to @Contract nvarchar(4000). Now, it can return 5o rows. Thank you,  Arif,

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to solve SSRS SQL 2008 R2 User Access Control (UAC) Permission Error With the introduction of SQL Server 2008 R2 and Vista (Windows 7 as well) came new enhanced security features. One of the features included was User Access Control (UAC) t…
How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question