[Sticky] INDEX: list of Proclaim Maths functions

Solved a problem in an elegant manner and want to show off your code? Know a hard-to-find feature? Post it here for the benefit of others. Questions don't belong here.
steve
Posts: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 times

TOBASE64

Post by steve » Tue Dec 15, 2015 3:00 pm

convert string variable or field to base64 encoded string
vtext = "hello"
v64=TOBASE(vtext)
message ("base64 encoded string: ", v64)

corresponding decoder is
FROMBASE64

aph1804
Posts: 6
Joined: Wed Mar 02, 2016 12:11 pm
Has thanked: 1 time

Re: CALL-ACTION

Post by aph1804 » Fri Mar 03, 2017 1:41 pm

steve wrote:CALL-ACTION (caseref,"Linked Action Code")
as per CALL-MATHS, but replace with the name of a linked action
Hi Steve

What's the best use for the CALL-ACTION prompt?

Are you running this from within a maths field in DB Maint or can it be run from an existing Linked Action?

Cheers
Adam

steve
Posts: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 times

Re: CALL-ACTION

Post by steve » Fri Mar 03, 2017 2:19 pm

Hi Adam,
you can run it from anywhere - maths or another linked action, but it's only really useful for a very narrow set of circumstances.

This feature is good for 'caseless' autoroutines. The code for the RTA/ELPL portal is a good example.
Say you have an autoroutine that calls an external webservice, that returns a list of cases that need updating.
You can then cycle through each case using WEBNEXT and call a linked action on each case returned, using the CALL-ACTION command.

Using it in pretty much any other scenario has risks - no case locking is performed by CALL-ACTION,so you have to manage this yourself. There is no sanity checking of the "linked action code", and the linked action is not included in search results when you click the button in Workflow maintenance to see where a specific linked action is in use (you have to perform a text search in Maths Search utility).

If you have some code that you might want to run as a maths field or a linked action, then I am a fan of creating one Maths field in DB maintenance, then having your linked action simply containing "vrun={my maths field.Text}"
Hope this helps


aph1804 wrote:
steve wrote:CALL-ACTION (caseref,"Linked Action Code")
as per CALL-MATHS, but replace with the name of a linked action
Hi Steve

What's the best use for the CALL-ACTION prompt?

Are you running this from within a maths field in DB Maint or can it be run from an existing Linked Action?

Cheers
Adam

aph1804
Posts: 6
Joined: Wed Mar 02, 2016 12:11 pm
Has thanked: 1 time

Re: CALL-ACTION

Post by aph1804 » Fri Mar 10, 2017 9:20 am

Hi Steve

Thanks for the info, proved a very useful command!
steve wrote:Hi Adam,
you can run it from anywhere - maths or another linked action, but it's only really useful for a very narrow set of circumstances.

This feature is good for 'caseless' autoroutines. The code for the RTA/ELPL portal is a good example.
Say you have an autoroutine that calls an external webservice, that returns a list of cases that need updating.
You can then cycle through each case using WEBNEXT and call a linked action on each case returned, using the CALL-ACTION command.

Using it in pretty much any other scenario has risks - no case locking is performed by CALL-ACTION,so you have to manage this yourself. There is no sanity checking of the "linked action code", and the linked action is not included in search results when you click the button in Workflow maintenance to see where a specific linked action is in use (you have to perform a text search in Maths Search utility).

If you have some code that you might want to run as a maths field or a linked action, then I am a fan of creating one Maths field in DB maintenance, then having your linked action simply containing "vrun={my maths field.Text}"
Hope this helps


aph1804 wrote:
steve wrote:CALL-ACTION (caseref,"Linked Action Code")
as per CALL-MATHS, but replace with the name of a linked action
Hi Steve

What's the best use for the CALL-ACTION prompt?

Are you running this from within a maths field in DB Maint or can it be run from an existing Linked Action?

Cheers
Adam

steve
Posts: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 times

PUTDATA

Post by steve » Mon May 15, 2017 10:36 am

PUTDATA( caseref , {field.type} , value )

allows you to update casedata from Proclaim Maths run from an Autoroutine with no case specified.

where:
caseref is a field or variable containing the case reference that you wish to put data into
{field.type} is the usual name and datatype of the field you wish to update
value is the value that you want to put into the field. Alpha fields need double "" surrounding the value.

Eclipse's code surrounds the PUTDATA with the usual locking commands

example something like

Code: Select all

#select cases you wish to update
SQL("mysql01","")
#for each case, update with a value
SQLFIRST
vcase = return-value
while vcase <> "?" DO
   OPEN (vcase, "LOCK")
   UPDATE(vcase, "")
   PUTDATA(vcase, {TPREF.Text},"ABC123")
   UPDATE(vcase, "")
   UPDATE(vcase, "UNLOCK")
   SQLNEXT
   vcase = return-value
END
See also GETDATA, CALL-ACTION and CALL-MATHS, which together are useful for operating on cases called from an autoroutine where no SQL is specified (e.g. a list of cases returned from a WEBSERVICE call)

revellbikes
Posts: 422
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 times

Re: [Sticky] list of Proclaim Maths functions

Post by revellbikes » Wed Jun 21, 2017 12:07 pm

DELETE-FILE

Accepts single variable

Code: Select all

DELETE-FILE( vPath )
Example of use - during importing of documents using Incoming Mail phrase, supply the file path, Proclaim sucks in the document then perform a COPY-FILE to move document into a processed directory and then DELETE-FILE on original document.

I.e:

Code: Select all

COPY-FILE( vPath , vNewPath ) 
DELETE-FILE( vPath ) 

proclaimadmin
Site Admin
Posts: 39
Joined: Wed Nov 30, 2011 9:37 pm

Re: [Sticky] list of Proclaim Maths functions

Post by proclaimadmin » Wed Jun 21, 2017 12:11 pm

revellbikes wrote:DELETE-FILE
Thanks revellbikes! Added to the index

steve
Posts: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 times

MODULO or MOD

Post by steve » Thu Aug 17, 2017 2:56 pm

MODULO or MOD

returns the the remainder after division of one number by another (sometimes called modulus).

syntax

Code: Select all

variable = x MODULO y
where:
variable = a Proclaim maths variable
x = dividend
y = divisor

the variable would therefore be set to the remainder left when dividing x by y

EXAMPLE:

Code: Select all

#get the YEAR portion of today's date, divide by 4 and look at the remainder:
vmod = YEAR(TODAY) MODULO 4
if vmod = 0 then
  message ("Leap Year")
  #store in my new Number field
  put (366, {days in this year.Number})
else
  message ("Not a Leap Year")
  put (365, {days in this year.Number})
end

JohnMuff
Posts: 3
Joined: Mon Aug 10, 2015 1:00 pm
Been thanked: 2 times

Re: [Sticky] INDEX: list of Proclaim Maths functions

Post by JohnMuff » Fri Oct 19, 2018 9:43 am

Here's a few more that aren't in the original list.
Some are only available with latest V3.3.4 of Proclaim:

ACCOUNTS-UPDATE
ADVCONFLICTCHECK
ARCHIVE
CALENDAR-ENTRY
CDH-REFRESHVIEW
CHR
FETCHCLOSE
FETCHDATA
FETCHERRORMSG
FETCHFIRST
FETCHLAST
FETCHNEXT
FETCHPREV
FETCHQUERY
GUID
INSERT
MD5-DIGEST
NO-REDISPLAY
NO-UPDATE
PUTACCOUNTS
SET-GLOBAL-VARIABLE
SHA1-DIGEST
TABLEAMEND
TABLECANCEL
TABLECLEAR
TABLECOPY
TABLECOUNT
TABLECREATE
TABLEDELETE
TABLEFIRST
TABLEGETCURRENT
TABLELAST
TABLENEXT
TABLEPREVIOUS
TABLEREFRESHALL
TABLEREFRESHCURRENT
TABLEREFRESHSELECTED
TABLERESET
TABLESAVE
TABLESELECT
TABLESELECTCOUNT
TABLESETCURRENT
TABLETRUECOUNT

proclaimadmin
Site Admin
Posts: 39
Joined: Wed Nov 30, 2011 9:37 pm

Re: [Sticky] INDEX: list of Proclaim Maths functions

Post by proclaimadmin » Mon Oct 22, 2018 11:56 am

Thanks John for adding these. I have updated the master list.

Post Reply