Skip to content

Contains useful scripts to extend functionality in Objectif Lune's Planetpress Connect DataMapper.

License

Notifications You must be signed in to change notification settings

danipoma/OL-Connect-utility-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAQ

Why script is not written in modern javascript?

OL Connect / Planetpress JS engine doesn't have modern features built in (const, classes etc.), that is why script might seem archaic.

Tips & Tricks

Complex scripts in Location Mode

In that mode you are not allowed to use statements.

However we can break ourselves free like this:

split().map(x => {
// I am free!
let a = 5;
let b = 10;
return a + b;
})[0];

You can use what we extracted (variable x) and you can also see what region it gathered, so if you need to do some complex logic, you can do it in location-based extraction and still get added benefits.

And there is no limitation. If you want to gather multiple locations through data.extract(), you certainly can.

It is working just like script-based extraction, but you get visibility of one region on top of it.

Adjust record information field multiple times

PlanetPress DataMapper allows you to extract certain field only once per record.

You can however use Action Step.

You can access current record (if in loop) like this:

record.tables.detail[steps.currentLoopCounter-1].fields.YourField = 'Your New Value';

Just note that you can't save this path to variable since it copies value instead of making a reference to it.

But I would refrain from using steps.currentLoopCounter as it doesn't give you intellisense on your fields and also limits your possibilities of use.

Rather create counter variable and increase count every time you find a new record.

let recordCnt = -1;

Then increase it at some point:

recordCnt++;

Then finally use it:

record.tables.detail[recordCnt].fields.YourField = 'Your New Value';

By using it like that, you can restrain some parts of your gathering based on your recordCnt state, you can also have secondary variable and have calculation logic that would allow line splitting etc.

About

Contains useful scripts to extend functionality in Objectif Lune's Planetpress Connect DataMapper.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published