Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
This is a complicated one and I am looking for some creative solutions to this. I've tried various methods but I think my knowledge of Talend may be letting me down here.
I'll begin with that I am trying to achieve then explain. I want to insert a new column which shows one of the following values - ANSWERED, UNANSWERED, BLOCKED, UNAVAILABLE, ABANDONED based on looking at other columns with various combinations. However, it is not as straight forward as that. Part of the problem I am having as well is two of the columns I need to look at are in date format.
There are 4 columns with values which combined create the value for the new column which we shall call TYPE for the purpose of this. The columns are ChatType, ChatStatusType, Answered, Started. ChatType & ChatStatusType contain numbers and are listed in Talend as strings (that can be changed if it will resolve this issue) Answered and Started are date fields (that cannot be changed unless a duplicate of the column is created as I need to preserve the original date columns).
Below is a key of how the TYPE values are calculated:
ANSWERED Anything with an Answered time
UNANSWERED Anything with a started time but no Answered time
BLOCKED ChatType 5 and any ChatStatusType
ChatType 8 and ChatStatusTypes 10,13 or 18
UNAVAILABLE ChatType 3 and any ChatStatusType
ChatType 8 and ChatStatusTypes 7,8,11,12,14,15,16 or 17
ChatType 0 and ChatStatusTypes 7,8,11,12,14,15,16 or 17
ABANDONED Anything not already catagorised by the above
Important things to note, originally I have hoped I could work this all out without the use of the date columns. I looked at concatenating the ChatType, ChatStatusType and using a look up however, it is possible to have a combination in ChatType, ChatStatusType that on it's own may read as one type but is actually another once you factor in the date columns. If the date columns can be duplicated and then replaced with 1 for contains a value and 0 for does not in the tMap then in theory a concatenation of all 4 columns could be used for a look up or replace after the tMap. However, I have yet to be able to duplicate the column in the tMap and convert it's value to a 1 or a 0 and join it with the other columns needed to create a final column with a numerical value which could be looked up.
Attached a screenshot showing sample data. The red column I have put in using excel manually to show what the output of the new column should look like.
This seems like a complicated nightmare to me but there might be a very simple way to resolve it. Any thoughts welcome, I assume some kind of lookup or replacement after the tMap is going to be the easiest way to do this but I'm struggling to output two duplicate versions of the date columns from the tMap containing 1's and 0's and have them be added to a new column with the other columns required.