Page cover

jsHandy Tips

This page

Checking for new rows

Include the following code at the start of your rule to check for new rows. Only works for:

  • Export Manipulation

  • Text Manipulation (Export)

  • Comparison Rules

  • Display rules

Does not work for

  • Text Manipulation (Import) because you only have access to a single source

const isNewRow = rowData.isMissingInSecondaryDatasource === true && rowData.isFoundInSecondaryDatasource  === false;

Converting text to a JSON list

A common thing we see is to convert a list of id + value pairs into a list of JSON.

You'll often see data like this in SharpSync which may be a list of values from one or more sources

1:Value1|2:Value80|3:value15

You might want to convert this into a JSON list like this

[
    {id} : {display_name}
]

So in our example the output will be

The easiest way to do this is to use an LLM like ChatGpt, Gemini, Claude, Copilot or any other publicly available LLM (or your own hosted one).

To do so enter the prompt below, then copy and paste the list:

Conditional logging in the browser dev tools

Logging in the dev tools can quickly overwhelm anyone. Create a function logOutput at the top of your advanced script rule

Then further on in the script, log some data

You can then easily control the logging for the entire accessor by simply toggling the value for

shouldLogOutput

to true or false

The output will look like this

(accessorName) C-34014-100: Skipping this item because value is: MyValue

Last updated