[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: 554
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 151 times

TOBASE64

Post by steve »

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

21-1-22 corresponding decoder is NOT
FROMBASE64
as this serves some other purpose, but is
DECODE-BASE64-STRING
available in 3.5.0.02 and 3.4.1.23

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

Re: CALL-ACTION

Post by aph1804 »

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: 554
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 151 times

Re: CALL-ACTION

Post by steve »

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: 9
Joined: Wed Mar 02, 2016 12:11 pm
Has thanked: 1 time

Re: CALL-ACTION

Post by aph1804 »

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: 554
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 151 times

PUTDATA

Post by steve »

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: 543
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 18 times
Been thanked: 56 times

Re: [Sticky] list of Proclaim Maths functions

Post by revellbikes »

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: 55
Joined: Wed Nov 30, 2011 9:37 pm
Has thanked: 1 time
Been thanked: 4 times

Re: [Sticky] list of Proclaim Maths functions

Post by proclaimadmin »

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

steve
Posts: 554
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 151 times

MODULO or MOD

Post by steve »

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: 3 times

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

Post by JohnMuff »

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: 55
Joined: Wed Nov 30, 2011 9:37 pm
Has thanked: 1 time
Been thanked: 4 times

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

Post by proclaimadmin »

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

Post Reply