Sum of array members using pml

2571515_Programmirovanie.jpgIf we need to calculate sum of array members,
we don have such method in standard functionality. Also we don’t have ability to create array with n-th members only have to push them manually with loop.

We can use such pml code to workaround.

Lets imagine that we have string !string equals to 1,2,3,4,5,6,7,7,6,5,4,3,2,1

!string = ‘1,2,3,4,5,6,7,7,6,5,4,3,2,1’
!array = !string.split(‘,’)

var !arrayGrp eval ” indices !array
var !indGrp sort !arrayGrp lastingroup !group
var !totGrp subt !array !indGrp !group

q var !totGrp.last()

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.