I have been fighting with this for days without a satisfying result.
I am loading data from Jira and need to transform it with Table Transformer to fit my needs.
Example and columns:
Key | ABC-657 (if S=Parent) or AAA-657 AAA-658 (If S=Child)
S | Parent or Child
Parent Key | ABC-657
Sponsor | Super Sponsor (SSAB)
Labels | #AA-Type or AA-Type or AA-TYPE
Description | Long Text Long Text Long Text Long Text Long Text Magic Sentence 1 Long Text Long Text Long Text Long Text Long Text Long Text Long Text Long Text Magic Sentence 2 Long Text Long Text Long Text Long Text Long Text Long Text
STEP 1 (Works fine): SELECT TOP 2 'Key', // just for testing purposes
STEP 2 (Works fine): CASE WHEN 'Labels' LIKE "%AA-Type%" THEN "AA-Type" ELSE NULL END AS AA-Type,
STEP 3: For 'Description' column, flatten the text VARCHAR
Then RETURN the String Between string "%Magic Sentence 1%" and string "%Magic Sentence 2%". ELSE IF String not Found THEN "Formating error" AS 'Short Description'
STEP 4: Hide 'Description' and 'Short_Description' column // to improve performance for testing.
STEP 5: COUNT CHAR 'Short_Description' AS 'SD_Count'. IF 'SD_Count' NULL OR <155 THEN "Description needs fixing" AS 'Error' ELSE "Description OK"
STEP 6 (Works fine): IF 'Sponsor' NOT NULL THEN
WHEN 'Sponsor' LIKE "%SSAB%" THEN "SSAB"
WHEN 'Sponsor' LIKE "%SSEF%" THEN "DEF"
IF 'Parent Key' not NULL then
WHEN 'Parent Key' LIKE "%SSAB%" THEN "SSAB"
WHEN 'Parent Key' LIKE "%SSEF%" THEN "SSEF"
This code applies for 2 Tables which are then joined and a new Table transformer comes in:
Same Columns.
STEP 1: If 'Sponsor' NULL AND 'S'="Child", THEN MATCH value of 'Parent Key' with All values in column 'Schlüssel'. IF MATCH THEN RETURN Value for 'Sponsor' of matching row. ELSE IF 'S'="Parent" THEN Return value for 'Sponsor'. ELSE if no match THEN "Error - no Sponsor" AS 'Sponsor Short'
Step 2: IF 'S'="Parent" MATCH the value in 'Key' with all values in column 'Parent Key'.
IF No match, THEN "No Children" ELSE RETURN COUNT of MATCHES AS 'Children'