Scripting Class Object

Scripting Class Object

From within VBScript operations (ScriptedVariable, VBScriptProcedure, ScriptedField) in additional to normal VBScript functions, the developer has access to a custom “Starfish” class. The tables below define its usage. This class may also be used with C#, Javascript and Python scripting. For VBscript you can access the method directly. For other language, you must prefix the property and method names with "Starfish.", such as Starfish.JobName.

Stage Variables

You can use these stage variables like you would use a variable in your code. For example, you could have VBScript where you wanted to see if a stage resulted in an Update or Insert, so you could do If "@@STG:0,#Action@@" = "Update" Then...

Stage variables are retrieved using a 0-based index, such as @@STG:N,#Action@@ where the the N is the index of the stage of you want to retrieve results for. If you want to get the Action for the 3rd stage in your job, your format would look like "@@STG:2,#Action@@"
Property Name
Description
#Action
Mostly used in an After (Repeat Each Stage) Operation script. It will return the action that was taken for a given stage. Returned values can be "Update", "Insert", "Skip", or "Ignore". When using in VBScript, you can reference as "@@STG:0,#Action@@" for the first stage. For use in C#, Javascript & Python use Starfish.GetStageVariable(0, "#Action").

example C# script which tests the stage Action to see if it resulted in an Insert, if so it calls another stage - otherwise it skips to the next row:
  1. if (Starfish.GetStageValue(0,"#Action") == "Insert")
        Starfish.GotoStage("Contacts")
    else
        Starfish.GotoNextRow(); //otherwise go to the next
 #ID
In the result of a Stage action "Insert" or "Updated", the ID returned is ID or Primary Key of the record that was created or updated in this stage. The format of this ID depends on the connection type used for your Destination and is returned by the underlying API being called.

example C# script which logs the the first stage's ID and writes it to an Xref list:
  1. var originId = Starfish.Origin("ID");
    var stageId = Starfish.GetStageValue(0,"#ID");

    Starfish.LogMessage("The ID was: " + id);
    Starfish.XRefWrite("contacts",  originId, stageId)

Class Properties

You can use these class properties like you would use a variable in your code. For example, you could have VBScript where you wanted to see if you were running or Previewing, so you could do If PreviewMode = True.

Property Name
Description
 string ProjectName
 Read-only. Returns the name of the Project that the currently running Job belongs to.
 string JobName
 Read-only. Returns the name of the currently running Job.
string CurrentStageName
Read-only. Returns the name of the current stage. Useful during “Repeat Each Stage” Exec Operations to determine path of execution/next steps.
string TotalRows
Returns the total number of Origin Rows in the job.
string CurrentRow
Returns the current row number.
string ReturnValue
Sets the return value to the calling application. Useful for passing an output back when the Job was called with an argument.
string Origin (string fieldName)
Returns the current Origin row’s value for the field specified as a string. NULL values are treated as an empty string.
 object OriginData [string fieldName]
 Returns the current Origin row’s value for the field specified in it's native data type.
bool PreviewMode
This boolean variable can be used to determine if you are Previewing or Running a Job. Returnes True of False. Ex: If PreviewMode <> True Then...

Class Methods

Project Variables Class Methods

These values can be seen and modified on the Variables tab under at the Project level. The values are persistent across jobs and runs, and are project-specific.

Method Name
Description
string GetSetting (
  string name
)
Retrieve a project variable by name.
example: var lastOrderDate = Starfish.GetSetting("LastOrderDate")
void SaveSetting (
  string name,
  string value
)
Save a project variable by passing in the name and value. If a variable already exists by the same name, it is overwritten.
example:  Starfish.SaveSetting("LastOrderDate", Starfish.Origin("OrderDate"));
string DeleteSetting (
  string name
)
Deletes the project variable by name.

Starfish Stage & Job Control Class Methods

Method Name
Description
void GotoStage (
  string stageName
)
Directs Starfish Engine to go directly to a Stage (skipping any others before it). String Parameter is the Name of the stage to go to. Once GotoStage has been called within a Job, it is considered in a “manual operation mode”. No more stages will be called in order and it will be up to the user to implement a After Each Stage Exec Operation to control stage flow. If no After Operation is called, it will go to the next row after the stage runs.

GotoStage Parameters:
  1. (String) stageName - Name of the stage to run next
example C# to run different stages, depending on an Origin row field:
  1. void CSharpProcedure()
    {
        bool isPersonAccount = Starfish.OriginData("ISPERSONACCOUNT");
        if (isPersonAccount)
            Starfish.GotoStage("Contact");
        else
            Starfish.GotoStage("Account");
    }
void GotoJob (
  string jobId
)
Directs Starfish Engine to go directly to a Job. Pass in the GUID of the Job found on the Settings Tab, "Current Job ID". Please use with caution, without checks, it would be possible to get a job stuck in an infinite loop.

GotoJob Parameters:
  1. (String) jobId - ID of the job to run.

void GotoNextRow ()
Skips all Stages and moves to the next Origin row.

example C# to skip a row, depending on the value of an Origin row field:
  1. void CSharpProcedure()
    {
        string orderType = Starfish.Origin("Type");
        if (orderType=="Quote")
            Starfish.GotoNextRow();
    }
void EndJob (
  string reason,
  [bool treatAsFailure]
)
Cancels the Job execution immediately, ending with the reason provided. By default, calling EndJob is treated as an error/failure - and will result in failure email notifications being sent. If calling EndJob is a part of normal operation, and you don't want it to be treated as a failure, pass in false for the 2nd parameter.

EndJob Parameters:
  1. (String) reason - Reason to be logged that the job is ending.
  2. (Optional, Boolean) treatAsFailure - Should this EndJob be treated as an error/failure? This can trigger different types of notifications and logs. Optional, default: true.
example:  Starfish.EndJob("no file available for processing", false);

Lookup and data retrieval Class Methods

Method Name
Description
object ExecScalar (
  string sql,
  [string connection]
)

Executes a SQL SELECT statement against the Destination database. Returns the first column of the first row returned by the query. Compatible with SQL-compliant connections. Default connection is the Destination.

To query the origin instead, use the second parameter of "ORIGIN".


ExecScalar Parameters:
  1. (String) sql - SQL Statement to execute
  2. (Optional, String) connection - Connection to run against. Valid values are "ORIGIN" or "DESTINATION". Optional, default: "DESTINATION".
example: Starfish.ExecScalar("select id from company", "ORIGIN")
object ExecScalarCache (
  string sql,
  [string connection]
)
Same as ExecScalar, except that results are cached and before a query is executed, a search is performed on a locally-stored set of results to prevent execution of identical queries, thus boosting performance. Should only be used for queries where multiple identical queries may be run (such as looking up user id’s or picklist values) – otherwise could consume resources needlessly.

ExecScalarCache Parameters:
  1. (String) sql - SQL Statement to execute
  2. (Optional, String) connection - Connection to run against. Valid values are "ORIGIN" or "DESTINATION". Optional, default: "DESTINATION".
void ExecSQL (
  string sql,
  [string connection]
)
Executes a non-query statement, such as UPDATE or DELETE against the destination database. Returns number of rows affected. Compatible with SQL-compliant connections.

ExecSQL Parameters:
  1. (String) sql - SQL Statement to execute
  2. (Optional, String) connection - Connection to run against. Valid values are "ORIGIN" or "DESTINATION". Optional, default: "DESTINATION".
object SmartLookup (
  string tableName,
  string fieldName,
  string queryFilter,
  [bool enableCache],
  [string orderBy],
  [string connection]
)

Performs a lookup against the destination database, and returns one field value based on supplied filter.

SmartLookup Parameters:
  1. (String) tableName – Table to perform lookup in
  2. (String) fieldName – Name of field to return
  3. (String) queryFilter – Filter code (such as Where clause, not including keyword “Where”)
  4. (Optional, Boolean) enableCache – Default False. Enable cache for this lookup. This cache lasts for ALL chained Jobs. If you are looking up the Account in chained Jobs for Invoices, Payments, Sales Order, etc, it may be a good idea to enable caching.
  5. (Optional, String) orderBy – Default Blank. Order By
  6. (Optional, String) connection – Default "DESTINATION". Use "ORIGIN" to query the Origin. You can also pass a Connection ID if you want to query another connection.
object SmartQuery (
  string tableName,
  [string queryFilter],
  [string fieldNames],
  [string connection]
)
Performs a lookup query against the destination database, returns all columns and all rows from query as a multi-dimensional array.

SmartQuery Parameters:
  1. (String) tableName – Table to perform the query in
  2. (Optional, String) queryFilter – Filter code - format depends on the connection. Optional, default: "".
  3. (Optional, String) fieldNames – Comma-separated list of columns to return. Optional, default: return all columns.
  4. (Optional, String) connection – Default "DESTINATION". Use "ORIGIN" to query the Origin. You can also pass a Connection ID if you want to query another connection.

If the filter and columns parameters are left blank, you may pass a full SQL statement into the first parameter for SQL-compliant connections.

example: arr = SmartQuery("team_sets_teams","deleted = 0 and team_set_id = '@@ORG:team_set_id@@' and team_id <> '@@ORG:team_id@@'","team_id","ORIGIN")

object SmartQueryDT (
  string tableName,
  [string queryFilter],
  [string fieldNames],
  [string connection]
)
Same as above, except returns the results as a System.Data.DataTable object.

Intended for C# scripting only; to use it will be necessary to add the following to the .NET Global - External Assemblies: "System.dll,System.Xml.dll,System.Data.dll".

SmartQueryDT Parameters:

  1. (String) tableName – Table to perform the query in.
  2. (Optional, String) queryFilter – Filter code - format depends on the connection. Optional, default: "".
  3. (Optional, String) fieldNames – Comma-separated list of columns to return. Optional, default: return all columns.
  4. (Optional, String) connection – Default "DESTINATION". Use "ORIGIN" to query the Origin. You can also pass a Connection ID if you want to query another connection.
example C# to retrieve lines for a given Order and concatenate some simple information together as a string:
  1. object ScriptedField()
    {
        string orderId = Starfish.Origin("OrderId");
        DataTable dt = Starfish.SmartQueryDT("OrderLines", "OrderId='"+orderId+"'", "Product, Quantity, Price", "DESTINATION");
        string orderLines = "";
        
        foreach (DataRow row in dt.Rows)
        {
            orderLines += "Product: " + row["Product"] + " ";
            orderLines += "Quantity: " + row["Quantity"] + " ";
            orderLines += "Price: " + row["Price"] + "\r\n";
        }

        return orderLines;
    }

Other Class Methods

Method Name
Description
void LogMessage (
  string message,
  [MsgBoxStyle classification]
)
Appends a custom message to the Log which will always be displayed (even if Logging Level is set to None).

LogMessage Parameters:
  1. String message - Message to add to the log
  2. MsgBoxStyle classification - Valid options are vbInformation, vbQuestion, vbExclamation, vbCritical. Optional, default: vbInformation.

example: Starfish.LogMessage("foo");

string SendEmail (
  string toAddress,
  string subject,
  string body,
  [string fromAddress],
  [string fromDisplay],
  [string ccAddress],
  [string bccAddress],
  [bool bodyHtml],
  [string attachments]
)
Sends an email directly from within the VBScript function/procedure. SMTP Server settings are pulled from the values entered on the General tab.

SendEmail Parameters:

  1. (String) toAddress semicolon-separated list of Email Recipient Address(es).
  2. (String) subject – Subject of the Email
  3. (String) body – Body of the Email
  4. (Optional, String) fromAddress - From Address. Optional, default: "Starfish ETL Monitor"
  5. (Optional, String) fromDisplay - From Display. Optional, default: "monitor@starfishetl.com"
  6. (Optional, String) ccAddress semicolon-separated list of CC Address(es). Optional, default: none.
  7. (Optional, String) bccAddress - semicolon-separated list of BCC Address(es). Optional, default: none.
  8. (Optional, Boolean) bodyHtml - Body Format sent int HTML. Optional, default: false (email is sent as plain text).
  9. (Optional, String) attachments - Comma-separated list of attachments, pulled from the user's "Files" area. Optional, default: none.
Returns: String if there was an error, will contain the mail server error message. If the return string is empty, the email was sent successfully.

example C# script to send an email containing information for the Origin row:
  1. void CSharpProcedure()
    {
        var toAddr = Starfish.Origin("BillToEmail");
        var subject = "Order #" + Starfish.Origin("OrderId") + " confirmed";
        var body "Thanks for your order ...";
        
        Starfish.SendEmail(toAddr, subject, body);
    }
string ParseName (
  string fullName,
  string namePart
)
Parses as string containing a person’s name, and returns the part of the name requested.

ParseName Parameters:

  1. (String) fullName – Input String containing entire name
  2. (String) namePart – Part of the name to return. Valid part values are "Title", "First", "Last", "Middle", "Pedigree", "Degree".
Returns: String with the part of the name requested. If this part couldn't be found within the full name, a blank string is returned.

This function expects name in "First Last" format. Names passed in "Last, First" format will not be parsed correctly.

example C# to extract parts of a person's name:
  1.     var name = "George Washington";
        var firstName = Starfish.ParseName(name, "First");
        //firstName contains "George"
        var lastName = Starfish.ParseName(name, "Last");
        //lastName contains "Washington"

string RemoveIllegalXMLCharacters (
  string xmlString
)
This function removes Illegal XML Characters from a string. This function can be used on a string before inserting it into the Target to resolve the "error in msg parsing: XML error parsing SOAP payload on line 32: Invalid character" error.

RemoveIllegalXMLCharacters Parameters:
  1. (String) xmlString - string to clean of illegal characters.
Returns: String with the illegal characters removed.

string GetStageValue (
  int stageIndex,
  string fieldName
)
Returns the destination value used on a previous stage.

GetStageValue Parameters:
  1. (Integer) stageIndex – Index number of the stage, 0-based.
  2. (String) fieldName – Field name of the value from this stage to return.
Returns: The value of the field from the stage requests. See the "Stage Values" section above for use in retrieving the stage #Action and #ID.
void SetLastRunDate (
  [DateTime lastRunDate]
}

This will write the Last Run Date/Time to an Xref List within your project named "lastrundates". Note that this Method MUST be run in an After Operation and Executed as "Once After Conn". Use this to Retrieve Records Modified After Last Run DateTime.

Use @@VAR:LastRunDate@@ in your origin to use the stored value. Note that you may run into TimeZone issues. Please see Retrieve Records Modified After Last Run DateTime for workarounds.


SetLastRunDate Parameters:
  1. (Optional, DateTime) lastRunDate - The DateTime value to override and write out for this job. Optional, default: uses the datetime of when the job started.
bool IsEmailValid (
  string emailAddress
)
Returns True if supplied email address is in a valid email format; otherwise false.

IsEmailValid Parameters:
  1. (String) emailAddress - The email address to evaluate
Returns: Boolean indicating if the email address if formatted correctly.

string FormatDate (
  string date,
  string formatString
)
Returns date in supplied format. This function uses the .NET DateTime formatting notations found here: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

FormatDate Parameters:
  1. (String) date – Date to format
  2. (String) formatString – Format String e.g.: "dd/MM/yy", "yyyy-MM-dd"
Returns: String of the date in the new format. If an invalid date or format is provided, function results in a blank string.

C# example: var newdt = FormatDate(olddt, “yyyy-MM-dd hh:mm:ss”)
string GetMD5Hash (
  string source
)
Returns an MD5 encoded hash of the provided source string.

GetMD5Hash Parameters:
  1. (String) source – string to generate a hash for
Returns: MD5 hash of the source
string GetSHA256Hash (
  string source
)
Returns an SHA256 encoded hash of the provided source string.

GetSHA256Hash Parameters:
  1. (String) source – string to generate a hash for
Returns: SHA256 hash of the source

File Class Methods

Method Name
Description
bool FileExists (
  string fileName
)
Returns boolean indicating whether the file by the provided name exists. These file operations are performed within your instance's "Files" area.

FileExists Parameters:
  1. (String) fileName - Filename to check for
Returns: Boolean - true if the file exists, false if not.
bool MoveFile (
  string sourceFile,
  string destinationFile
)
Moves a file on the server.

MoveFile Parameters:
  1. (String) sourceFile – From filename path
  2. (String) destinationFile – To filename path
Returns: Boolean indicating if the operation was successful.
bool CopyFile (
  string sourceFile,
  string destinationFile
)
Copies a file on the server.

CopyFile Parameters:
  1. (String) sourceFile – From filename path
  2. (String) destinationFile – To filename path
Returns: Boolean indicating if the operation was successful.
bool DeleteFile (
  string fileName
)
Deletes file on the server.

DeleteFile Parameters:
  1. (String) fileName – name of the file to delete
Returns: Boolean indicating if the operation was successful.
string ReadFile (
  string fileName
)
Reads a file in text mode and returns the contents as a string.

ReadFile Parameters:
  1. (String) fileName – name of the file to read from
Returns: String with the contents of the file. If the file doesn't exist, a blank string is returned.
bool WriteFile (
  string fileName,
  string contents
)
Writes the supplied contents to a file in text mode. If the file doesn't exist, it gets created. If the already exists, it is is overwritten.

WriteFile Parameters:
  1. (String) fileName – name of the file to write to
  2. (String) contents – text contents to write to the file
Returns: Boolean indicating if the operation was successful.

Compression Class Methods

Method Name
Description
bool ExtractZipToDirectory (
  string fileName,
  string path
)
Extracts a zip archive to the specified path.

ExtractZipToDirectory Parameters:
  1. (String) fileName – Source zip filename
  2. (String) path – The path to extract to
Returns: Boolean indicating if the operation was successful.
bool CreateZipFromDirectory (
  string path,
  string fileName
)
Creates a new zip archive with the contents of the specified folder.

CreateZipFromDirectory Parameters:
  1. (String) path – The path to the contents to be zipped
  2. (String) fileName – Filename for the new zip archive
Returns: Boolean indicating if the operation was successful.

Xref Class Methods

Method Name
Description
void XRefWrite (
  string listName,
  string oldId,
  string newId
)
Writes a entry to a Xref list.

XRefWrite Parameters:
  1. (String) listName – cross-reference list name
  2. (String) oldId – ID 1 ("Old ID": the ID you’ll look up by in future jobs
  3. (String) newId – ID 2 ("New ID": the ID you’ll want returned by future lookups)
example C# script which writes a Stage #ID result to an xref list:
  1. void CSharpProcedure()
    {
        var oldId = Starfish.Origin("ContactId");
        var newId = Starfish.GetStageValue(0, "#ID");
        Starfish.XRefWrite("contacts", oldId, newId);
    }
string XRefRead (
  string listName,
  string oldId
)
Reads an ID entry from an Xref list. (Returns ID 2 from above)

XRefRead Parameters:
  1. (String) listName – cross-reference list name
  2. (String) oldId – ID 1 ("Old ID")
example C# script which reads from an Xref list based on an existing ID.
  1. void CSharpProcedure()
    {
        var oldId = Starfish.Origin("ContactId");
        var newId = Starfish.XRefRead("contacts", oldId);
    }
void XRefClear (
  string listName
)
Deletes all of the values within a Xref list. Useful to call this function in a Pre-Process script to clear a list.

XRefClear Parameters:
  1. (String) listName – cross-reference list name

Xref-Flag Class Methods

Only compatible with database Xref format. These methods allow user to set a 'processed' flag against each entry within a Xref list. Useful in applications where you need to keep track of whether a particular records was processed or not. For example, if you need to detect whether records were removed from a source list where they previously existed. To query a list of unprocessed xref entries, it is recommended to set your Origin to use the SQLite Connector, connect to your engine.db, and read directly form the xref table.

Method Name
Description
void XrefSetFlag (
  string listName,
  string oldId,
  bool flag
)
Sets the flag value for a given entry within a list.

XrefSetFlag Parameters:
  1. (String) listName – cross-reference list name
  2. (String) oldId – ID 1 (the "Old ID" value to look up the entry by)
  3. (Boolean) flag - value to set the flag to (True/False)
bool XrefGetFlag (
  string listName,
  string oldId
)
Gets the current Boolean flag value (True/False) for a given entry within a list.

XrefGetFlag Parameters:
  1. (String) listName – cross-reference list name
  2. (String) oldId – ID 1 (the "Old ID" value to look up the entry by)
Returns: Boolean with the flag value.
bool XrefClearFlag (
  string listName
)
Sets the flag to False for all entries within a given list.

XrefClearFlag Parameters:
  1. (String) listName – cross-reference list name

Conversion Methods

Method Name
Description
string ConvertRTFToText (
  string rtfString
)
Converts the supplied Rich Text string to Plain Text.

ConvertRTFToText Parameters:
  1. (String) rtfString - String formatted as RTF (Rich Text)
Returns: Plain text string, with all formatting removed.
string ConvertHTMLToText (
  string htmlString
)
Converts the supplied HTML string to Plain Text.

ConvertHTMLToText Parameters:
  1. (String) htmlString - String formatted as HTML
Returns: Plain text string, with all formatting removed.
byte[] ConvertBase64ToBytes (
  string base64String
)
Converts the supplied Base64 string to a byte array/binary.

ConvertBase64ToBytes Parameters:
  1. (String) base64String - Data encoded as Base 64
Returns: Byte array with the data converted to binary
DateTime ConvertTimeZone (
  DateTime sourceDate
  string sourceTimeZone
  string destinationTimeZone
)
Converts the given DateTime from one Time Zone to another.

ConvertTimeZone Parameters:
  1. (DateTime) sourceDate - The DateTime you want to convert.
  2. (String) sourceTimeZone - The current Time Zone of the provided DateTime.
  3. (String) destinationTimeZone - The Time Zone that you want to convert the DateTime to.
Returns: DateTime converted to the new Time Zone.

JSON Methods

Method Name
Description
bool ParseJson (
  string json
)
Loads the passed in string into the JSON parser. For use in subsequent calls to GetJSON. ParseJSON values do not get reset between each row. You have to run ParseJSON("{}") in a before operation if you want to reset the JSON for GetJSON back to empty.

ParseJson Parameters:
  1. (String) json - the JSON string to be loaded into the parser. This can either be a JSON Object or a JSON Array.
Returns: Boolean indicating if the JSON was valid and loaded.
string GetJSON (
  string item1,
  [string item2],
  [string item3],
  [string item4],
  [string item5],
  [string item6],
  [string item7],
  [string item8],
  [string item9]
)
Returns a given section from the JSON supplied in the last ParseJson call. The optional strings are for accessing nested values, you can pull data up to 9 levels deep.

GetJSON Parameters:
  1. (String) item1 - The first parameter in the path of data to retrieve.
  2. (String, Optional) item2 - The second parameter in the path of data to retrieve.
  3. (String, Optional) item3 - The third parameter in the path of data to retrieve.
  4. (String, Optional) item4 - The fourth parameter in the path of data to retrieve.
  5. (String, Optional) item5 - The fifth parameter in the path of data to retrieve.
  6. (String, Optional) item6 - The sixth parameter in the path of data to retrieve.
  7. (String, Optional) item7 - The seventh parameter in the path of data to retrieve.
  8. (String, Optional) item8 - The eighth parameter in the path of data to retrieve.
  9. (String, Optional) item9 - The ninth parameter in the path of data to retrieve.
Returns: A string containing the JSON portion requested.
GetJSON Usage Example
For example, if you had this JSON, which was borrowed from https://adobe.github.io/Spry/samples/data_region/JSONDataSetSample.html
{
     "id": "0001",
     "type": "donut",
     "name": "Cake",
     "ppu": 0.55,
     "batters":
           {
                 "batter":
                       [
                              { "id": "1001", "type": "Regular" },
                              { "id": "1002", "type": "Chocolate" },
                              { "id": "1003", "type": "Blueberry" },
                              { "id": "1004", "type": "Devil's Food" }
                       ]
           },
     "topping":
           [
                 { "id": "5001", "type": "None" },
                 { "id": "5002", "type": "Glazed" },
                 { "id": "5005", "type": "Sugar" },
                 { "id": "5007", "type": "Powdered Sugar" },
                 { "id": "5006", "type": "Chocolate with Sprinkles" },
                 { "id": "5003", "type": "Chocolate" },
                 { "id": "5004", "type": "Maple" }
           ]
}

And you wanted to get the type of the 2nd batter, you would do this with 0-based indexing:

var val = Starfish.GetJSON("batters","batter",1,"type");
val would equal “Chocolate”.

int JSONArrayCount ()
Returns the number of elements within the JSON array loaded using ParseJson.

Queued Data Methods

Method Name
Description
string GetQueuedJSON (
  [string dataset]
)
Retrieves the data registered by queued stages in JSON format.

GetQueuedJSON Parameters:
  1. (String, Optional) dataset - The dataset name used on the stage, useful in case you need to queue multiple datasets at the same time.
Returns: JSON Array containing the data that was loaded during the Queued stage execution.
string GetQueuedXML (
  [string dataset]
)
Retrieves the data registered by queued stages in XML format.

GetQueuedXML Parameters:
  1. (String, Optional) dataset - The dataset name used on the stage, useful in case you need to queue multiple datasets at the same time.
Returns: XML containing the data that was loaded during the Queued stage execution.
string GetQueuedDT (
  [string dataset]
)
Retrieves the data registered by queued stages as a .NET DataTable object, for use in C# scripting only.

GetQueuedDT Parameters:
  1. (String, Optional) dataset - The dataset name used on the stage, useful in case you need to queue multiple datasets at the same time.
Returns: DataTable object containing the data that was loaded during the Queued stage execution.
void SetQueuedJSON (
  string json,
  [string dataset]
)
Sets the queued data by taking a JSON Array input, which can be used for "Repeat" stages. Used to make a Stage iterate over multiple sub-records per row. In the subsequent stages which pulls out this data, you use the Queued("fieldName") function to retrieve data at the field-mapping level.

SetQueuedJSON Parameters:
  1. (String) json - JSON Array string containing any number of rows and fields.
  2. (String, Optional) dataset -
    The dataset name used on the stage, useful in case you need to queue multiple datasets at the same time.
void SetQueuedDT (
  DataTable dt,
  [string dataset]
)
Sets the queued data by taking a .NET DataTable object which can be used for "Repeat" stages. Used to make a Stage iterate over multiple sub-records per row. In the subsequent stages which pulls out this data, you use the Queued("fieldName") function to retrieve data at the field-mapping level. For use in C# scripting only. Useful for when queuing data from the result of a SmartQueryDT() function call.

SetQueuedDT Parameters:
  1. (DataTable) dt - DataTable object which already contains columns and rows.
  2. (String, Optional) dataset -
    The dataset name used on the stage, useful in case you need to queue multiple datasets at the same time.
object Queued (
  string fieldName
)
Retrieves a single field value's from the Queued dataset, typically for use when a Stage's Queued Behavior is set to "Repeat".

Queued Parameters:
  1. (String) fieldName - Field/Column name to pull from the current queue data row
Returns: String containing the data for the requested field.


    • Related Articles

    • Using StarfishETL Scripting Class Properties & Methods in C#

      See available StarfishETL Scripting Class Variables, Properties and Methods. To use these variables, properties and methods, you must append "Starfish." to the beginning of variable, property or method AND you must use the exact capitalization as ...
    • Examples of using StarfishETL Class Functions In Javascript

      This code was used to lookup a value inside of SugarCRM using the Sugar REST connector. function scriptedField() { var res = ""; res = vals["Branch Name"]; if (res) { Starfish.LogMessage(res.toString()); } res = ...
    • Clarizen Connector

      Connecting to Clarizen Set up your Clarizen connector using your normal Clarizen username and password. You'll be able to select which environment you want to connect to if you have access to multiple Clarizen sites. Origin Queries Origin queries use ...
    • Repeating a Stage using Queued Datasets

      Sometimes when building maps, it becomes necessary to call a stage multiple times to process a subset of nested data. Take for example an Origin which may return an Account, but then also a list of Contacts in a structured format (such as JSON). To ...
    • Microsoft Dynamics ERP - AX Connector

      Our Microsoft Dynamics AX Connector is no longer supported.  We will offer support for Microsoft Dynamics 365 Finance and Operations in the near future. Parameter Description Domain Object Server Dynamics AX Connection Edit Screen