How get output like this using talend - data-warehouse

I have the dataset like this
and want out put like this how can I do that
Here is sample dataset
ID COMP_ID CAR_ID ENGINE COLOR CC
1 c1 car3 xyz blue 2500
2 c2 car4 xyz white 1000
3 c1 car6 xyz green 3500
4 c2 car1 xyz black 4500
5 c3 car5 xyz green 4000
6 c1 car2 xyz red 3000
7 c2 car3 xyz gray 1500
8 c3 car4 xyz silver 2000

You can try a tJavaRow something like :
output_row.foo=input_row.row1+"\n"+input_row.row2;
foo must exist in your Output Schema
and row1 and row2 in your Input Schema
Else, you can concatenate them in a TMap in the same way.

Related

Add two numbers up to one constant

I have a constant number X. I also have two numbers that add up to it. How can I make it so that if I change one number, the other number automatically changes so that it still adds up to X.
I have tried to take subtract the one number from X and add it to the other number, but instead I got two numbers in the thousands.
Assuming your constant value is 10, you can set this in a cell and make all your other calculations based on it.
For example, you can have cell C2 containing your constant, in this example, 10
Then in C4 you can have the number which you change, and the value of C5 will be equal to the value of the constant minus the value in C4.
You can then finally do your sum wherever you want, adding up the values of C4 and C5.
Here's an example Spreadsheet:
Untitiled spreadsheet โ˜†
File Edit View Insert Format Data Tools Extensions Help Last edit was 2 minutes ago
โ†ถ โ†ท ๐Ÿ–ถ โฎท | 100%โฏ† | $ % .0 .00 123โฏ† | Default(Ro... โฏ† | 10 โฏ† | B | I | S | A |โฏ|โ˜ฐ
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
1
2
Contsant:
10
3
4
Number 1:
3
5
Number 2:
=(C2 - C4)
6
7
Sum:
=(C4 + C5)
8

how to generate a "serie" of numbers based on a value:

I am stuck with a little problem.
i would like to auto-generate a Serie of numbers(is this the right description?):
for example:
The input/value in A1 is 5
the OUTPUT in B1 should now be 1
in
in cell B2 - 2,
B3 - 3,
B4 - 4,
B5 - 5,
B6 - 1, (STARTING at one again)
B7 - 2
. . . and so on until end of range
if I then change the value in A1 to 7 for example it should now "count" from 1 to 7 and repeat until the end of the range again.
any hints available would be much appreciated
=ARRAYFORMULA(MOD(SEQUENCE(ROWS(B2:B),1,0),A1)+1)
this is creating an array of numbers from 0 to however many rows there are on the sheet, then taking the modulus of each number using the value of A1 as a divisor.
MOD() means "what's the remainder after dividing by [n]?" where N in your example case is 6 or 7 or whatever.

GoogleSheet : Crossing data from two tables

Using GoogleSheet, I have two tables as input:
First table:
Name
val1
val2
val3
val4
Joe
X
X
X
Jess
X
X
X
Mark
X
X
meaning that Joe has val1 . val3 . val4, Jess has val1 . val2 . val4, Mark has val2 . val4
Second table is like a matrix:
โ€ƒโ€ƒโ€ƒ|โ€ƒval1 โ€ƒ|โ€ƒ val2 โ€ƒ|โ€ƒ val3 โ€ƒ| โ€ƒval4โ€ƒ
โ€ƒval1โ€ƒ โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒwarn Aโ€ƒโ€ƒwarn B
โ€ƒval2โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒerrA
โ€ƒval3
โ€ƒval4
identifying some couples of values associated with some text: val1.val3:warn A, val1.val4:warn B, val2.val3:err A
As result, I would like to join these two tables for extracting a table like this:
Name โ€ƒ| Resultโ€ƒโ€ƒโ€ƒโ€ƒ
Joe โ€ƒ โ€ƒwarn B (val1.val4), warn A (val1.val3)
Jess โ€ƒโ€ƒwarn A (val1.val4)
Markโ€ƒ
I need to address it using googlesheet but I fail, I have too many steps of transformation and finally I'm lost.
Currently, I though that using binary or operator could help. I proceed like this:
#1 Transform second table table2 in new dec values from base2 :
โ€ƒโ€ƒโ€ƒ|โ€ƒval1 โ€ƒ|โ€ƒ val2 โ€ƒ|โ€ƒ val3 โ€ƒ| โ€ƒval4โ€ƒ
โ€ƒval1โ€ƒ
โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ10โ€ƒโ€ƒโ€ƒ9
โ€ƒval2โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ โ€ƒโ€ƒโ€ƒโ€ƒ โ€ƒ6
โ€ƒval3
โ€ƒval4
Each bit corresponds to Val[bit position]. ex : val1 => 1000 , val2 => 0100
(Val1, Val4) => BITOR(1000,0001) = 9
#2 same kind of transformation for the first table table1:
Name | val1(8) | val2(4) | val3(2) | val4(1)|
Joe โ€ƒ โ€ƒ8โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ 2 โ€ƒโ€ƒโ€ƒโ€ƒ1
Jessโ€ƒ โ€ƒ8โ€ƒโ€ƒโ€ƒโ€ƒ4โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ โ€ƒ โ€ƒโ€ƒ1
Markโ€ƒ โ€ƒ โ€ƒโ€ƒโ€ƒโ€ƒ4โ€ƒ โ€ƒ โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ1
#3 extract relevant values form table2
=filter(transpose(flatten(table2)),transpose(flatten(table2))<>0)
I obtain : 10 | 9 | 6 (from table2)
#4 I sum rows in table1:
Name
sum
Joe
11
Jess
13
Mark
5
#5 I apply BITAND operator IF(BITAND(term2,term1)=term1,"Warn") between each terms from terms1 11 | 13 |5 and terms2 : 10 | 9 | 6
for Joe:
So as BITAND(11,10)=10 then i got a "Warn" for 1010 => (Val1,Val3)
So as BITAND(11,9)=9 then i got a "Warn" for 1001 => (Val1,Val4)
So as BITAND(11,6) not = 6 then nothing
But I implemented this for a small set of data as example and nothing is dynamic regarding the number of columns and rows... I guess if there a kind of function or query which could replace in a good way my poor code.
try:
=ARRAYFORMULA({A2:A5, REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(REGEXMATCH(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(B2:E5="X", B1:E1, )),,9^9))), TRANSPOSE(QUERY(FLATTEN(
IF(B12:E16="",,A12:A16&".*"&B11:E11)),
"where Col1 is not null"))), TRANSPOSE(QUERY(FLATTEN(
IF(B12:E16="",,B12:E16&" ("&A12:A16&"."&B11:E11&"),")),
"where Col1 is not null")), )),,9^9))), ",$", )})

Google sheets -- format rows x color if column A is x/y/z value

I have a google sheet and it looks something like this.
# | quant | percent
1 | 10 | 10%
2 | 5 | 5%
3 | 10 | 10%
...
22| 3 | 3%
Etc
What I want to do is for EACH row, paint columns A/B/C the same color as column A. Column A should be: Green if # < 5, Yellow if between 5 and 10. Red if >10.
Thus column A should look something like this but with all columns having the same color as this row:
Is this even possible
After an actual 2 hours of googling here's a rule that can use the fill handle to satisfy this
=IF($A:$A<=5, true)
And then adapt for between / greater than.

Duplicates in Google Sheets

I am using Google sheets and I am trying to concatenate multiple column A values in Column C, when and if Column B has a duplicate:
Sample data:
Column A Column B Column C
1 1247 Santa Fe 1250/1150
2 1250 Santa Fe 1247/1150
3 1258 North Shore 1354
4 1341 Hogan 1255
5 1255 Hogan 1341
6 1354 North Shore 1258
7 1150 Santa Fe 1247/1250
Here, Column C needs to have multiple concatenated values of A, corresponding to the duplicates in column B.
C1:
=JOIN("/",FILTER($A$1:$A$7,$B$1:$B$7=B1,ROW($B$1:$B$7)<>ROW(B1)))
Drag fill down.

Resources