We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

example for calculation of value

Thread ID:

Created:

Updated:

Platform:

Replies:

129615 Mar 24,2017 11:45 AM UTC Mar 28,2017 12:56 PM UTC Data Integration Platform 4
loading
Tags: Data Integration
Gregory Kohle
Asked On March 24, 2017 11:45 AM UTC

Hi,

what is the preferred way to make calculations on exsisting values?
I get the values from a SQL Server and want to make calculations on them.
I tried this using UpdateAttribute Processor but the calculated value didn´t show up
in the file.
Is there some kind of option to get them to show up in the file?

I also tried using a script(Javascript) using OutputStreamCallback to do this. But this didn´t work either.
Can you provide me with an example on how to do this?
Thanks.

Regards,
Patrick

Karthikeyan SankaraVadivel [Syncfusion]
Replied On March 27, 2017 07:21 AM UTC

Hi Patrick,  

Thank you for contacting Syncfusion support.  

what is the preferred way to make calculations on exsisting values?

 
The Data Integration Expression Language provides the ability compare them to other values, and make some calculations on the existing values. 

Please refer the Expression language guide for more details - https://help.syncfusion.com/data-integration/expression-language-guide  
I get the values from a SQL Server and want to make calculations on them.
I tried this using UpdateAttribute Processor but the calculated value didn´t show up 
in the file.  
In Data Integration Platform, we have provided the preloaded sample Data flow(templates) that deals with data transformation.  
Some of them are ,  
·         Boolean Operations 
·         Column Operations 
·         Conditional Operations 
·         Mathematical Operations 
·         Searching Operations 
·         String Manipulation 
·         Substring Operations 
·         JsonToSQL 

In order to utilize this sample you need to initiate the preloaded samples in to the Data Integration Platform.  
I also tried using a script(Javascript) using OutputStreamCallback to do this. But this didn´t work either.

 
In order to execute your scripts you can use “ExecuteScript” processor to achieve your use case.  

Can you provide me with an example on how to do this? 
Please refer our above mentioned example templates for data transformation.  
  


Regards, 
Karthikeyan S  


Gregory Kohle
Replied On March 28, 2017 06:24 AM UTC

Hi Karthikeya,thanks for your response.I got a simple script working, where the values from the sql server are overwritten with Hello World.How do I get the script to append the value to the exsisting values?How do I read a specific value from the content of the flowfile? Is this possible via a script or is a custom processor the better solution?I tried to use session.append instead of session.write, but this resulted in a MethodMissingException.My script is attached.The use case would be the following: Execute SQL -> ExecuteScript-> SplitAvro-> ConvertAvroToJSON->ConvertJSONToSQL->PutSQLScript: import org.apache.commons.io.IOUtils    import java.nio.charset.StandardCharsets         flowFile = session.get()    if(!flowFile) return    def txt = 'Hello world!'    // Cast a closure with an inputStream and outputStream parameter to StreamCallback    flowFile = session.write(flowFile, {inputStream, outputStream ->      text = IOUtils.toString(inputStream, StandardCharsets.UTF_8)        outputStream.write(txt.getBytes(StandardCharsets.UTF_8))    } as StreamCallback)    session.transfer(flowFile, REL_SUCCESS)What would be the correct input for the module directory for a javascript script?Thanks. Regards,Patrick

Gregory Kohle
Replied On March 28, 2017 07:22 AM UTC

Hi Karthikeya,

got it working now.

Regards,
Patrick

Karthikeyan SankaraVadivel [Syncfusion]
Replied On March 28, 2017 12:56 PM UTC

Hi Patrick,  

Thank you for contacting Syncfusion Support.   

Please get back to us if you need further assistance. We will happy to assist you.  

Regards,  
Karthikeyan S   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;