Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Task 4 – Advanced Topics - Introduction  Chris Woyton  Support/Training 

Similar presentations


Presentation on theme: "1 Task 4 – Advanced Topics - Introduction  Chris Woyton  Support/Training "— Presentation transcript:

1 1 Task 4 – Advanced Topics - Introduction  Chris Woyton  Support/Training  Chris.woyton@kineticdata.com

2 2 Task 4 – Advanced Topics – What we’re going to learn.  Source Data  Accessing Source Data  Setting up a “harness”  Retrieving Results  Processing Results  Routine Scope (time permitting)  Global vs Local  Calling a Routine from an External Source

3 3 Source Data – What is it?  Source Data is the raw presentation of data submitted to a Task Tree.  It is in JSON format.

4 4 Source Data – Why use it?  Source Data has ALL the data, not just what is exposed by the source file.  Useful for AdHoc Sources.  Always available.  Good starting point for creating Source Files.

5 5 Source Data – Activity 1 – Planning.  Use Case: create a Task Tree that takes two numbers and multiplies them together.  Be able to extract the terms to be multiplied from the source.  Use an Echo node to perform the main function of the Tree.

6 6 Source Data – Activity 1 – Create the “stub” Tree.  Open the Kinetic Task 4 console.  Select “Build”  Add an Echo Node with the following parameter   Save the Tree.

7 7 Source Data –Activity 2 – build a Harness.  A harness page lets us specify precise parameters.  It’s a good method to see what format the Source Data will be in.

8 8 Source Data – Activity 2 – Build a Harness.  Create a Text File with your favorite editor.  Insert the following HTML: Term1: Term2:

9 9 Source Data – Activity 2 – Build a Harness.  The important line of our harness is the URL:   Note the naming of the URL matches the Tree “path” in the Builder:  /kinetic-task/app/api/v1/run-tree/ Playground/Test/MyTree

10 10 Source Data – Activity 2 – Build a harness.  Save the file.  Open it with your favorite Web Browser.  You should see something like this:

11 11 Source Data – Activity 2 – Execute the Tree.  Enter 2 numbers in the “Term”fields.  Submit.  You should see a result similar to this:  {"message":"Initiated run #6485 for the \"Playground :: Test :: MyTree\" Tree.","run":{"createdAt":"2015-05- 07T12:33:36.307Z","createdBy":“Demo","id":6485}}  Note the Run Number.

12 12 Source Data – Activity 2 – Build a Harness.  Open the Run in the Task Admin Console.  Note the results of the Echo Node.  You should see something like this:  {"Term2":["4"],"Term1":["17"]}

13 13 Source Data – Activity 3 – Parse our Data.  Now that we have results back from the harness, we can proceed to work on providing the functionality.  The JSON object is natively available in the Task Engine and usable via an Echo node.  No separate handler is needed!

14 14 Source Data – Activity 3 – Parse our Data  Note the structure of the JSON being returned:  A label attached to an array.  When we create the JSON object, we can reference the terms by name and values by index.  For example: txt = JSON.parse(@source['Data']) txt['Term2'][0].to_i * txt['Term1'][0].to_i

15 15 Advanced Task 4  Questions?


Download ppt "1 Task 4 – Advanced Topics - Introduction  Chris Woyton  Support/Training "

Similar presentations


Ads by Google