SSRS report join datasets according parameter values - reporting-services

I have different dataset . Each for a country (USA,FRANCE,BRITAIN etc.) .
Also i have a Report multi value parameter to select country , so the report will show data only from the selected countries.
Several questions:
1. How can i join (merge) different datasets as described below?
2. I need to have a table in the report with the Country Column .

How about a table with separate tables for each country?
Create the table you want for a country (I'll C1 from here).
Create another table (T1) with cells the same width as C1. Delete the DATA row. Add a new row for your country. Merge the cells from the new row.
Put the headers from C1 on T1 and delete the header from C1. Put C1 into T1's single merged cell.
Copy C1 to create a new country and add a new line and repeat for all countries - changing the dataset for the new country.
Use the table row's visibility to show that country of not based on your parameter.
I think I've done this once a while back.

Related

How to get the first 4 rows of each record in table and append to the select instead rather than rows?

I have two tables:
documents table
audits table.
audits table is a polymorphic table and has auditable_type and auditable_id which is linked to the id of documents table. audits table also has event and new_values column.
Here's the table schema.
documents table has user_defined_field JSON column.
My goal is I want to get the first 4 values of the status field in user_defined_field JSON column. There will be a column in the report of the web app to display the 1st Status, 2nd Status, 3rd Status, 4th Status.
So basically, it's like the documents table is join to audits table and should get the first 4 record of the document id and display it in the SQL select as status_1, status_2, status_3, and status_4
Thank you.

Is it possible to create a MYSQL view where a single field could be populated from two different fields in a table based on a condition?

I am trying to create a View using certain fields from a single MYSQL table. But in one of the fields in the Table, I need to populate the field from either one field in the table or another field in the same table based on the value of a third field in the table. Is this possible, and if so, how?
To explain, The table contains data from two suppliers. The entries in the table from "Supplier A" store the Account Number in field CustomerNumber while the entries in the table from "Supplier B" store the Account Number in field CustomerAcct. The view I need to generate needs to list all of the customer orders from both suppliers combined, and populate a single field in the view called AccountNumber with either the value from CustoomerNumber or CustomerAcct, depending on which supplier filled the order.
Is this possible?
You'd use the "case" function, as in mysql case
CASE
WHEN Supplier = 'A' THEN customernumber
ELSE customeraccount
END as accountnumber

MS Access loop query for every row on a table

I'm not very experienced with MS Access and I'm trying to loop through every record on a table (tbl_jobs_main) and run this query against it.
SELECT division.[Department]
FROM division
WHERE tbl_jobs_main.[org1] = division.[ORG1];
My hope is that the new column "Department" in the tbl_jobs_main table can be auto filled from the division table with the Department values by matching the ORG1 values for each row. To clarify, the ORG1 values in the division table are unique and the org1 values in tbl_jobs_main are duplicated.
Any assistance would be greatly appreciated.
Edit:
(Sorry, not enough rep to post images on this profile.)
Example data in Division table:
https://i.stack.imgur.com/LYDh3.png
Example data in tbl_jobs_main table:
https://i.stack.imgur.com/zIel9.png
I need for the Department column to populate with the corresponding Department in the Division table based on the matching ORG1 value.
Ideally I could run something so the tbl_jobs_main becomes this:
https://i.stack.imgur.com/VU1ko.png
Whilst you can loop through tbl_jobs_main and update the Department based on data in the Division table, you can also use an update Query. The SQL will look like:
UPDATE tbl_jobs_main AS J INNER JOIN Division AS D
ON D.Org1=J.Org1
SET J.Department=D.Department
However, I am not sure why you would want to do this. If the name of "Dept1" in the division table changes, you then have to re-update tbl_jobs_main to reflect this. Far better to use Access as a relational database, where you store the department information in the Division table, and link the tables.
Regards,

If values in one column is entered populate other columns (Access)

So I have an Access database that I'm trying to build and was wondering was there a way that if I type in an ID into one table that it can populate values in the adjacent column from another table.
For example I have table_1 that has columns User ID and User Number.
And now that I'm creating table_2 I want when I enter the User Number that it populates the value for another column which will be User ID, sort of how a vlookup would work in excel.
I already built a relationship for the User Number column in table_2 so when I type in the value its pulling from table_1. But I can't get column User ID to populate with the corresponding value. Thanks
You don't need to build a second table that duplicates the data. Since you already have it in table 1 you can always refer to that relationship when querying data and should do so in order to avoid discrepancies between the two tables. In this instance if you want to return the user id from table 1 when you specify a user number you should just create a new query using the sql code:
SELECT table_1.[User Number], table_1.[User ID]
FROM table_1
WHERE table_1.[User Number] IN (12345, 12346, 12347);
In this example, the 12345, 12346, 12347 represent your user numbers for which ID's you were wanting to return; so you should only replace those values with your search parameters.

MS-Access: Replace values in column based on mapping list

I got a column with 27 thousand entries. I want to replace all occurences of "a" with "a_new", all occurences of "b" with "b_whatever". And so on. I got more than 1200 of these mappings. Can I somehow put my mappings into a list and feed it to MS-Access so that it replaces the values in a specific column?
Create new table with mapping - [OldValue] and [NewValue] columns, then join this table with your existing table by [OldValue] column and update by value from '[NewValue]`