SSIS lookup a table with multiple business conditions - ssis

I need to do a lookup against a table with different business conditions on each column:
Against the first column is a "natural" lookup (equal).
Against the second column, the lookup is like : if they match, give me the result, if don't match, select the rows with empty fields.
Same thing this for the 3th, 4th, 5th column and eventually you just get one row, and the 6th column of this row is the matching value I need
My question is how to implement this logic against a lookup table with different business conditions on each column. Should I implement this with a store procedure?

I see no reason for a stored procedure. Just implement it in the SQL query used by the Lookup.

Related

Two Way table in knime?

I am new to KNIME and I have a question, I have column splitter node that is outputting one column and one row. This will naturally have one value in the cell. I want to feed this value into a column of a table in KNIME. How do I do this?
I Don't see two way tables in KNIME.
You can use the Cross Joiner node to append the constant column. (There is also the Table Row to Variable and Constant Value Column combination if the constant value is one of the primitive types (String, Double, Int).)
You may need the RowID node to replace/restore the row ids.

how to populate column from the content of other columns after a row is inserted in the same table in mysql

I have a table traffic with 7 columns, namely toll_id, date1, shift, car_single, car_return, car_local and car_total.
How could I populate first 5 columns manually, and then store a value in column car_total, which will be the sum of car_single and car_return?
Here is the image of my table:
Just to add a 3rd and 4th ways of achieving the desired outcome:
If you have at least MySQL v5.7.6, you can use a generated column as car_total.
Alternatively, you can choose not to store car_total at all, but calculate this value on the fly while querying the table.
Having a column to store the results of the calculation is good if you regularly have search based on that field because you can use indexes to speed up the searches. Calculating the results on the fly may be better, if you just need to display the result of the calculation, but there is no need to filter on it.
There are two ways to do this:
Add the logic in the application itself, so that it calculates total before inserting the record. (Recommended)
Write an after insert trigger (http://dev.mysql.com/doc/refman/5.7/en/trigger-syntax.html) which calculates the count when record is inserted.

SSRS mutiple database source to be joined

Just stuck on getting information from two sources, we have a MYSQL database for repairs information which I have in SSRS, this brings back 7000 rows. We have another Repairs database in Oracle which brings back over 3 million rows.
I can't seem to bring the one from oracle as it exceeds the maximum limit, but is there any way do a left join using so i can bring only the two columns i need from the oracle one into the MySQl one which would mean i have 7000 rows plus the 2 columns from Oracle which have a common Primary key. I can't seem to join on two dataset with it being on two database.
Can anyone help.
THank you in advance
You can use the Lookup function in SSRS to find a value from one dataset based on a common key.
=Lookup(Fields!SaleProdId.Value, Fields!ProductID.Value, Fields!Name.Value, "Product")
Use Lookup to retrieve the value from the specified dataset for a
name-value pair where there is a 1-to-1 relationship. For example, for
an ID field in a table, you can use Lookup to retrieve the
corresponding Name field from a dataset that is not bound to the data
region.
(BIDs Description)
In the above example, the SalesProdID from one dataset is being used to relate to the ProductID in the Product table to get the Name field.
This will only return one value, though. This may or may not be OK depending on your data. If you need to return multiple values, use LookupSet.
=LookupSet(Fields!TerritoryGroupID.Value, Fields!TerritoryID.Value, Fields!StoreName.value, "Stores")
Use LookupSet to retrieve a set of values from the specified dataset
for a name-value pair where there is a 1-to-many relationship. For
example, for a customer identifier in a table, you can use LookupSet
to retrieve all the associated phone numbers for that customer from a
dataset that is not bound to the data region.
Unfortunately, you might need to SUM a Lookup but that isn't supported by a function in SSRS. Fortunately, users created a function for it:
SSRS Count Occurances based on multiple columns

Get value of table row

I've got two tables binded to two different datasets. I'm trying to reference one of the rows from one of the tables (Table A) from Table B.
Since it's outside the scope of the table, I can't use ReportItems![Textbox name].Value
Any ideas?
You can use the SSRS Lookup() or LookupSet() function to retrieve the data directly from the other dataset.
I found the MSDN pages a bit unclear, the syntax goes like this:
=LOOKUP(Fields!sourceMatchingField.Value,
Fields!targetMatchingField.Value,
Fields!targetReturnField.Value,
"Name of Second Dataset"
)
Fields!sourceMatchingField.Value is from the dataset that is
currently in scope.
Fields!targetMatchingField.Value is from the other data set you need to get information from and equals Fields!sourceMatchingField.Value.
These two parameter values for the Lookup function make the join criteria for the two datasets. They can be more complicated than simply two field references (such as using functions to manipulate on or both), but I'm just showing the simplest way to do it.
Fields!targetReturnField.Value is the field from the second dataset that you want to return. This should just be a reference to a field.
"Name of Second Dataset" is just what you've named the other dataset that you're joining to.

Getting the value present in table 1 to table2

I am trying to develop a report having two tables with one single data set.each table is filtered with the user giving a date parameter. is there any way that I can get the value present in a text of table1 into the table 2.
If you have a report with two table objects in it, both of which point at the same dataset, then all of the data in either table will be available in the other table - the only reason that one value would be available in one table but not the other is if the tables have different filter conditions. Therefore, you may need to amend the filter conditions.