Filling up values in a column in data stage - datastage

How can i add values in the fields of a column dynamically? I have a column called email and i want to make corresponding email indicator column fields as 'Y' or 'N' if email is present or not respectively.

you can use a transformer - it should be a simple logic (derivation) like
IF len(to_tx.EMAIL) > 0 then 'Y' ELSE 'N'

Related

Is there a way of creating a Serial Number based on other inputs on a MS access form?

I have some samples I need to take.
In order to create a good identifier/serial number for the samples, I want it to be a product of its characteristics.
For example, if the sample was taken from India and the temperature was 40 degrees then I would click dropdowns in the form to create those two entries and then a serial number would be spat out in the form "Ind40".
Assuming that your form is bound to a table, you can create a calculated column in the table that concatenates the values from other columns into a single value.
For instance, create a new column and give it a name (for example, SerialNbr). Then for Data Type select "Calculated". An expression builder window will appear:
Enter the columns you'd like to concatenate and separate them with &. Here is an example of how the expression could look:
Left([Country],3) & [Temperature]
This expression takes the first 3 chars from the Country column and combines it with the value from Temperature column to create the value in column SerialNbr. The calculated column will automatically update when values are entered into the other fields. I'd also suggest adding another value to the calculated expression to help avoid duplicates, such as date/time of submission.

Add filter/parameter in calculated field tableau

I'm trying to create calculated field in tableau, my below query is showing valid, however I want to give filter or parameter to it. For ex: I have a field called Account number and I want my below query to show sum of all the quarters revenue on account number level.
Sum(If ([Qtr]='2019-Q1' OR [Qtr]='2019-Q2' OR [Qtr]='2019-Q3' OR [Qtr]='2019-Q4')
THEN FLOAT([Revenue]) END)
Your logic will work.
For parameter: Create a parameter with String data type, add all field names to it. Then create a calculated field based on the parameter list. Add that calculated field to row shelf then change Parameter, the above formula will be recalculated.
For Filter: You can add filter directly.
1st option:
Add Account number as row in your worksheet
Create a Parameter String with values: 2019-Q1, 2019-Q2, 2019-Q3, 2019-Q4
Update your calculated field to:
If [Qtr]='Parameter Value' THEN FLOAT([Revenue]) END
Add this field as text and the value of sum will be for only that Qtr period
2nd option:
Add Account number as row in your worksheet
Create a Parameter String with values: 2019-Q1, 2019-Q2, 2019-Q3, 2019-Q4
Update your calculated field to:
[Qtr]='Parameter Value'
Add this field to the filters and the whole worksheet will filter on that Qtr period
You can also add another parameter for the year to be more flexible on the years

Discard blanks in datastage

I have a Datastage job which takes the data from a file to a Dataset and for a column I would like to make a transformation in order to exclude the rows where that columns has no value:
For example I use in the transfomer the following rule where I put 0 everytime I find no value in the column lcvInstalmentOriginalStr, but I need this row to be discarded from the begining.
If lcvInstalmentOriginalStr <> "" Then StringToDecimal(lcvInstalmentOriginalStr) Else 0
Thank you
You can use a condition within a transformer stage (for example) to put just those rows on the output link (to the Dataset) that hold data.
The condition could look like this
lcvInstalmentOriginalStr <> ""

Combine fields in transformation from "get rows from result" + info from a query

I have a PDI transformation that gets 3 fields from a result row:
SEARCH_VALUE
Asset
IP_V4_Address
The next hop is a table input that searches based on search value and returns one column value, something like abcd-1234.
SELECT DISTINCT p.txt_reqID FROM ...
Now, after my table input runs, the resulting stream only has 1 column (the txt_reqID). I'd like my output stream to have 4 columns - the original 3 + the new one from the table input. How do I do that?
Here is the transformation and the input row structure:
This is the table input setup:
I'm only able to access the txt_reqID field after the table input, I can't figure out how to tell it to pass the other 3 through.
You can achieve this by having Select values step after the Get rows from result step. Select Values is required to duplicate your SEARCH_VALUE as you need this field in both SELECT and in the WHERE clause and also it can be used to reorder the fields before table input.
In Table input you can use the query like
SELECT DISTINCT p.txt_reqId, ? as SearchValue, ? as Asset, ? as IPV4 address
FROM ... WHERE d.value like ?
Here is the sample for the same
click here for the image

Displaying only 1 row for duplicated data in tableau table

I have a table that displays 8 columns. Due to the way the data source is structured (I cannot change this) it sometimes means one or more of the columns will be the same across two rows.
I need to filter to show only one row of data. This is based on "email', so if an email has more than 1 row, I want one of the rows. If the other columns are the same or not doesn't matter.
I don't need to combine anything, and I don't care which row is displayed, I just need to remove one of the duplicated rows.
Replace this:
Place orderid email item name date
a 1 a#a.com b c 1/1/11
a 1 a#a.com d c 1/1/11
With this:
Place orderid email item name date
a 1 a#a.com b c 1/1/11
Or this:
Place orderid email item name date
a 1 a#a.com d c 1/1/11
Any help would be much appreciated! I had a go with LOD calculations and I couldn't make that do what I wanted (that may well be me not understanding how to use them properly, though).
Given your example, it appears the difference is within the [item] field. You can create an index calculation on it and filter for value of 1.
index()
Set the index to discrete and compute using the [item] and filter for only 1. You can hide the field if you don't want it to appear by deselecting Show Header.
If you want to show the first row per email, regardless of what's in the other fields, try the following:
Create an [Index] calc field using INDEX().
Add [Index] to rows shelf and change to discrete.
Edit the table calc for [Index], select 'Specific Dimensions' and restarting every email (dropdown menu). All of the checkboxes should be ticked by default.
Notice how the index is not restarting for each email as expected. To correct this, drag email checkbox to the top position.
From here, filter [Index] = 1 and hide index column from view.