use a multi-line variable array in a SSRS report - reporting-services

I have a large data set that holds the names and addresses of our customers. I need to allow the user to search this data set, however the user rarely has the key field necessary to make the search easy. They do however have three key values that will get them a reasonable subset to work with. They have the customer's last name, street and zip code. While this does not assure a single match, for the most part I should be in the less than 10 returns range. I am guessing most will only return 1 value.
I would like to have the user submit multiple lines of the three values and then return the appropriate values to user. I am looking at putting a new value in my table that has the three values concatenated, but I would have approximately 19 MM rows of data affected. I was wondering if there was some way with SSRS to submit an array variable with the three fields and then return multiple lines based on the values?
I am using SQL Server 2012 as the database.

Yes like BishNabo wrote, In your SQL just add the below structure with your field and table names. I've wrapped #var in wildcards to allow for partial values. This format requires all three to be submitted by the user.
Where tbl.fld_LName LIKE '%#LastName%' and tbl.fld_StreetName LIKE '%#Street%' and tbl.fld_ZipCode LIKE '%#Zip%'
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d6952bd0-af17-403f-8402-02759a9517fb/execute-tsql-on-ssrs-2012-with-3-parameters?forum=transactsql

Related

MS-Access - Append Query - Carry MVF

Before I start I need to say I know multi-valued fields are a bad way to store data. However, because of the data and what it will be used for it seemed the easiest way and this problem has been bugging me for a short while
I am building a database that has multiple different tables based on Candidates and their specialized job sector
I have multiple queries that take data from one table to another depending on inputted values
I have a table called TblClient, which holds all the client names
I have a table called TblCandidateSupport, within this table, I have a lookup field that holds multiple values from TblClient (only needed so I can see which candidate has been to which clients)
The problem I am having is when I run an append query to the values stored in the multi-valued field to another table called TblCandidateSupportAvailable.
I either get an error "An INSERT INTO query cannot contain a multi-valued field" or only get one value appending when I use.value.
The value that is appended from the TblCandidate will only ever be viewed.
What is the best way to carry the data across?

MS Lightswitch Application, add temporary fields in data table

I have a requirement to add a temporary field in a data table. There are two types of fields you can add in data table. One is DATA fields which are actual fields, and Second is COMPUTED fields which have some limitations (not discussing here).
Let me explain my scenario, I have a table with fields Qty, Rate and Amount. Now I need to add one more field like InputRate which will be just a temporary field, do not have any role in the database. Why I need this is, I need to input rate let say in US Dollar, then then I have to convert this to my own currency say SAR. So I want that this temporary field will not save in database, but the actual one (the rate converted to SAR) will be stored.
We can do this easily in .Net windows Applications or Web Applications. But how can we do this in MS Lightswitch, because it will not allow to add fields on screen untill it is part of the data table. Even if you add a custom field (as I experiment) only on the screen, then it is going to repeat the same field's value for all rows (since my this table is DETAILS table). Means if my table has 5 rows, and in 6th row if I enter anything in custom field(with scope only on screen) then it is showing the same value of all other rows also, e.g. if I entered, then all other rows start also displaying the same value 10.
Any idea how to do this?

How to match text to a defined numeric value

I have a database that has a bunch of survey data that I would like to work with. For several questions, the values are things like "Very important","Not at all likely" and I want to create a calculated field to assign a numeric value to these responses.
I don't want to replace the responses at all since I am going to have a user fill out a form to append the data set. I do want to have a calculated field that will automatically assign a numeric value to a text response.
I would just use a vlookup or an IF function in Excel to do this, but the problem is that Excel can't handle as much data as Access can. I need to set it up so that all Excel will house is a pivot table from the Access database.
Could anyone please tell me if there is a good way to do this? I am just not sure how to do it.
Create a new table with 2 columns: user_value (text) and numeric_value (number). Get all of the user entered values uniquely from the user entered data table with a query (the sigma symbol gives you a group by query). Put these in your new table and assign a numerical value to them. Then you can create an output query which joins your data to the lookup table and retrieves the numerical value for each user entered value.

How do I select a specific column based on a variable in a MS Access query?

I have a large table with the following fields:
Date
Product_ID
AmountEUR_Field1
AmountEUR_Field2
AmountEUR_Field3
AmountEUR_Field4
AmountEUR_Field5
where each AmountEUR field represents the sales amount for a product.
The reason for having 5 different AmountEUR fields is that they are based on different Currency Rates (in example BeginingOfMonthRate, AverageMonthRate, EndOfMonthRate etc.).
I now want to copy a specific AmountEUR field to another table, but the AmountEUR field to be copied varies over time (sometimes it is AmountEUR_Field2, other times it is AmountEUR_Field5).
Therefore I need to select a specific column based on a variable from another table. (that variable should then have value between 1 and 5).
I have been thinking about making a new field called AmountEUR_ToBeUsed that is updated with the correct AmountEUR_Field, but that brings me back to the same problem of selecting the specific column I want copied.
Can a solution be made within the Access query designer, or do I need some VBA code?
You can just make this with the Access Query designer.
Specifically you will need the function IIF.
For instance, if you want to specify that before a date you wish to use AmountEUR_Field1, and otherwise AmountEUR_Field5 you can say:
IIF(somedate<#1/1/2011#,AmountEUR_Field1,AmountEUR_Field5)
Note, depending on the settings of your PC, you may have to say:
IIF(somedate<#1/1/2011#;AmountEUR_Field1;AmountEUR_Field5)

Calculation query in Access produces null result all the time

I am trying to create a community database in Access (2003 preferably). Part of the main table has several fields relating to personal relationships, with field names such as "Partner", Child_LT_16", Child_GT_16", "Parent", "Sibling" etc. On the entry form each of these fieldu can have a number entered for the number of each kind of relation. Each field is defined as "Integer". The entry and normal display via a form is OK for this basic operation. However I now want to have an additional field to be ised on Forms and Reports that show the total number of relations for each record.
I have constructed a query, with a calculated field of the form
Total_Relations:[Partner]+[Child_LT_16]+[Child_GT_16]+[Parent]+[Sibling]
This query doesn't throw any errors and runs without problems, BUT it doesn't return any value for any record. In all cases the Total_Relations column stays blank (empty).
It is as though the query engine is seeing all the field values as EITHER empty (some are empty others have values usually between 1 and 3, virtually all have a numeriacl value somewhere in the various relations fields) OR taking the field value as text and giving it a NULL value (but the fields are defined as Integers.
I have tried various things including using VAL([Partner]) etc. in case the fields were being taken as Text. In this case any record that had any NULL field threw-up an error message, only records where all relevent fiels had numeric values did not throw the error, but they still did't show a total (or any) value either.
I have tried recreating the query gain, from scratch, several time, but with the same result each time
I have done this type of calculation loads of time before without problem, but this one has me climbing upm the walls.
Any suggestions from anyone?
PLEASE............
In MS Access, if you add two (or more) values together and any one of them is null, then the result is null.
You need to check is each value null, or make the fields not null-able, so there will be zero values in there if nothing is entered.
Have a look at this for working with Nulls in MSAccess, Tip #5 is the one you want