Talend convert ENUM to string - talend

I have a migration task from mysql via talend to Salesforce. I have ENUM field in mysql and a text string in Salesforce. Which function should i append to convert ENUM to string? Now i have an error:
Type mismatch: cannot convert from Object to String

Option 1 : tMap
You can use tmap to convert to string from Object by explicit casting.
Option2 : tConvertType
You can use tConvertType component and change the datatype in the output schema of the component to String.

Since Talend 6.3, there is an option in tMap "Property Settings" (upper left corner) : Enable auto-conversion of types. Just check the box, see if it converts your Object type (input) to the expected String type in the output.

explictly cast your ENUM object to String.
(String)(ENUM_object)

Related

Arrow date in a pandas column

I am using arrow to get the dates of a single dataframe that has the following structure:
data=['2015', '2016','2017', '2108']
df= pd.DataFrame(data,columns=['time'])
I know that to get the date in arrow is with the following code:
arrow.get('2016')
Have tried to use this:
arrow.get(df['time'])
But it gives me this error: Cannot parse single argument of type <class 'pandas.core.series.Series'>.
How to tell arrow to use the column?
Thanks
Convert the entire series for access later
One option is to use pandas apply on the column. https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.apply.html
df.time = df.time.apply(lambda tm: arrow.get(tm))
Might be a way to do this with converters on load as well, depending on where you are loading from. csv docs for example, https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
I also wonder why you are using arrow time versus pandas built in datetime type. Once again, depending on how you are loading this data, dtypes could be used to specify datetime.
Convert one value from the series
You need to choose one value instead of providing all values (i.e. the pd.Series)
arrow.get(df.time[1]) would convert 2016 in your example.

Problems with the type of cloud DB HMS

I have a problem with the Cloud DB
Message:{"defaultName":"AGCError","name":"database-server","errorCode":{"code":"2052","message":"the input object is invalid."}}
I don't know what could be the reason ?
As per the Huawei Documentation, The error code 2052, it is described as “invalid input object”. So please check your input value or object
Below might be the causes. Please check:
Check any field longer input values which you declared as string. Because string data type field maximum value range is 200 character only. If the string contains more than 200 characters, you are advised to use the Text type. Refer -
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-data-type-0000001080815898#EN-US_TOPIC_0000001176121166__en-us_topic_0000001127251477_table2376546172218
Check the date field format. Because the date format should be (yyyy-MM-dd HH:mm:ss sss) like below

what formulas should be put for the date by sequence in crystal report?

There is an error message shown up for when I edit the formulas.
we want to sort the ship date by sequence.
parameter field
error message for "A date-time is required here"
If then else must return the same data type for all branches.
So Convert the dates to a string. For example, ToText({Ship_Date}, 'yyyyMMdd')
and convert the numbers to a string as well. For example, ToText({PartN}, 0, "")
ToText {CUST_ORDER_LINE.PART_ID}
is missing ()
Need to be
ToText({CUST_ORDER_LINE.PART_ID},0,"")

Using if condition on data type

I want to use a condition in my report based on the datatype.
I have a 'date' field which is of date format in some cases and in String format in other cases. For string format I do a conversion to get the date. No conversion is required for those already in date format.
For example, I am trying this in the expression editor:
$F{start}.getClass()== "class java.util.Date" ? "Date" : "String"
But it is printing "String" for date fields. What am I doing wrong here?
OK I got the solution, I was missing the 'toString()' function:
(($F{start}.getClass()).toString()== "class java.util.Date")?"Date":"String"

Compare dates with Spring Data neo4j

When querying for relationships on a java.util.Date property, what syntax should I use? I tried just using a query like (this is just an example to show what I'm trying to do, so please don't pay attention to variable names there):
#Query("start n1=node({0}) match n1-[r:TYPE]->n2 where r.dateCreated>={1} return r")
Page<Relationship> findAll(Node node, long date, Pageable pager);
But it throws the following error:
Caused by: Don't know how to compare that. Left: 1339845862883; Right: 1339827156836
at org.neo4j.cypher.internal.Comparer$class.compareValuesOfDifferentTypes(Comparer.scala:45)
at org.neo4j.cypher.internal.Comparer$class.compare(Comparer.scala:67)
at org.neo4j.cypher.commands.ComparablePredicate.compare(ComparablePredicate.scala:30)
at org.neo4j.cypher.commands.ComparablePredicate.isMatch(ComparablePredicate.scala:41)
at org.neo4j.cypher.internal.pipes.matching.PatternMatcher$$anonfun$isMatchSoFar$1.apply(PatternMatcher.scala:148)
at org.neo4j.cypher.internal.pipes.matching.PatternMatcher$$anonfun$isMatchSoFar$1.apply(PatternMatcher.scala:148)
I also tried by passing a Date but it just throws the same error but trying to compare a Long and a Date.
I am using spring-data-neo4j version 2.0.1.RELEASE
So the date property's long value is stored as a string in the graph (in newer versions of SDN you can define a #GraphProperty(targetType=long.class) on date fields.
So comparison will work if you pass in the parameter value as String.valueOf(longValue)