Transform CSV Column Values into Single Row - scala

My data in CSV is like this(Expected Image):
Actual Data
And I want to convert this Data into:
Expected Data
(hivetablename.hivecolumnname = dbtablename.dbtablecolumn)
By joining the multiple Row values into a Single row value like above.
Please note that 'AND' is a Literal between the condition to be built, which would appear until the second last record.
Once the Last Record is reached, Only the condition would appear(xx=yy)
I wish the result to be in SCALA SPARK.
Many thanks in advance!

Related

datenum and matrix column string conversion

I want to convert the second column of table T using datenum.
The elements of this column are '09:30:31.848', '15:35:31.325', etc. When I use datenum('09:30:31.848','HH:MM:SS.FFF') everything works, but when I want to apply datenum to the whole column it doesn't work. I tried this command datenum(T(:,2),'HH:MM:SS.FFF') and I receive this error message:
"The input to DATENUM was not an array of character vectors"
Here a snapshot of T
Thank you
You are not calling the data from the table, but rather a slice of the table (so its stays a table). Refer to the data in the table using T.colName:
times_string = ['09:30:31.848'; '15:35:31.325'];
T = table(times_string)
times_num = datenum(T.times_string, 'HH:MM:SS.FFF')
Alternatively, you can slice the table using curly braces to extract the data (if you want to use the column number instead of name):
times_num = datenum(T{:,2}, 'HH:MM:SS.FFF')

Breakout concatenated field into rows not columns within Tableau

I have two fields that contain concatenated strings. The first field contains medical codes and the second field contains the descriptions of those codes. I don't want to break these into multiple fields because some of them would contain hundreds of splits. Is there any way to break them into a row each like below? The code and description values are separated by a semicolon (;)
code description
----- ------------
80400 description1
80402 description2
A sample of the data:
One way is you can custom split two columns at ; which will create separate columns for every entry then you can pivot code columns and description columns separately.
One issue will be you can't guarantee if every code is mapped to correct description.
One more way is export data to excel sheet and then split and pivot the columns and then match the code and description, Then take the excel as datasource to the tableau.

How do I force tJavaFlex to generate multiple rows for a single row

How do I make tJavaFlex generate multiple output rows for a single input row? I don't want to use tSplitRow as I have to do other processing.
But for example, if I add a for loop inside my main code, and split my string into words the below happens, and I just get the last word in the sentence in my output flow:
tRowGenerator generating one sentence (1 row, one column):
tJavaFlex with loop in the Main section splitting the sentence into word tokens:
And this is what I get:
I had thought my loop would generate 10 rows in the output. Is there a way to make the tJavaFlex do this kind of multiplication of input rows?
In order to achieve your requirement, you need to use component tnormalize.
Below is just a sample job using tNormalize component and I have used the same string that you have used
I have provided item separator as "space"
I have got the below result for simple println statement
Hope this may help you out.

How to arrange a rowise data coming from hql query into columns based upon particular condition in JRXML

My hql query in JRXML file takes out data rowwise from a table. From this data I need to display some records as columns based upon particular condition.
For example I get data as below:
Subtopic1_Down_1
Subtopic1_Down_2
Subtopic1_Up_1
Subtopic1_Up_2
Subtopic1_Up_3
Currently my jrxml helps me to display data one after another dividing the data with group expression = value of subtopic. All Subtopic1_Down records together in one table. Followed by Subtopic1_Up records in next table and so on for remaining subtopics.
Subtopic1_down
Subtopic1_down_1
Subtopic1_down_2
Subtopic1_Up
Subtopic1_Up_1
Subtopic1_Up_2
Subtopic1_Up_3
But now I want the data to be displayed in such a way that all Subtopic1_Down and Subtopic1_Up records should be displayed in table but different columns as below:
Subtopic1
Down Up
Subtopic1_Down_1 Subtopic1_Up_1
Subtopic1_Down_2 Subtopic1_Up_2
How can I achieve it through Jrxml?
You can make use of scriptlets to modify the resultset row-wise data into column at run time.

I need to know if it is possible to create a SSRS report as defined

I have a query with 3 parameters that a user should be able to define:
AND (ORION_SCHED.TRIP.DATE_TIME = '09/11/2012')
AND (ORION.CUST.COUNTRY = 'BE')
AND (ORION_SCHED.TRIP.ID_SHIFT ='1')
DATE_TIME should be a datepicker
COUNTRY dropdown with defined values
ID_SHIFT dropdown with defined values
I guess this isn't an issue?
The result of this query will return the dataset
My actual question: I want the result to be presented in this way
So always 3 blocks of data next to each other, the data of every block is the result of the query filtered down on the column TRUCK_ID (a sub-select of the returned dataset)
The empty cells per block are a nice to have, these are non-unique values per TRUCK_ID that I don't wish to be repeated on every line, but like I said a nice to have.
I would add a new column to the query that returned 1,2 or 3 (for each different TRUCK_ID. Then I would use 3 Tablix (one per column on your report) and filter the data by the new column you added on the query.
Then you just group on the TruckID on each tablix and play around with the format. It should work.