[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

[Sticky] INDEX: list of Proclaim Maths functions

Post by steve » Thu Dec 01, 2011 8:23 pm

In this post we will try and collate examples of all the maths functions available in proclaim, including the ones not found in the standard documentation.
Please post examples into the forum, and we will collate them here. Note that because of lack of documentation, you should use them at your own risk, and after consulting Eclipse!
##update 26-1-11
I'm tidying up the list of maths functions with the help of the admin - the first post will list all functions with hyperlinks to the syntax/examples for each. I will slowly fill in those functions that don't have syntax/examples.

If anyone can help me by creating syntax/examples in a new post:

reply to this thread
change the subject to the name of the function - one per reply
Please include the Proclaim version number and the source documentation (release note/manual and date) if possible.

then I will get it linked into the main list

thanks all

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

Re: list of Proclaim Maths functions

Post by steve » Wed Jan 04, 2012 9:27 am

ACCOUNTS-UPDATE
ADREP
ADVCONFLICTCHECK
ARCHIVE
ASC
CALENDAR-ENTRY
CALL-ACTION
CALL-MATHS
CDATE("dd/mm/yyyy")
CDH-REFRESHVIEW
CHR
CLEAR-GLOBAL-VARIABLES("USER")
CONFLICTCHECK
CONFLICTCHECKSTORE(correspondents, search string, function,)
CLOCK
CLOSE
COPY-FILE
CREATE
CREATECASEVIEW (<username>.<caseref>,<output path>)
CURRENT
DATE
DATE-FROM-TODAY
DAY
DAYS-FROM-TODAY
DEBUG
DELETE DIARIES
DELETE-FILE
DIARY AN ACTION
DMS-COPY(from file, to file)
DMS-DELETE(file)
EDIT
EXEC-SP
EXPORT
EXQUERY
EXSELECT
EXSQL
EXTERNAL-APPLICATION
EXVIEW
FETCH
FETCHQUERY/FETCHFIRST etc
FETCHRECORDAVAIL
FILE-SIZE(file)
FIND-CASE
FROMBASE64
FROMHEX
GET-MEMORY ("Memory item name")
GETDATA
GLOBAL-VARIABLE
GUID
HMAC
HTTPSERVICE
IMPORT
INCOMING MAIL
INSERT
INTEREST
LAST-ACTION
LENGTH
LISTFIND
LISTITEM
LISTSIZE
LISTZIP (<zip filename>)
LMPROCESS
MAKE CALL
MD5-DIGEST
MESSAGE
MODULO or MOD
MONTH
NET
NO-REDISPLAY
NO-UPDATE
OPEN
OSGETENV
PDFBAR
POSTING
PRINT
PUSHNOTIFICATION
PUT
PUTACCOUNTS
PUTDATA
QUESTION
RANDOM
RANGE
REDISPLAY
REFRESHVIEW
RENAME-FILE
RESULT
ROUND
SCREEN
SECONDS
SELECT PRINTER
SEND ECONOMIC_DOCUMENT
SEND E-MAIL
SEND FAX
SEND LETTER
SEND MEMO
SEND SMS
SET-GLOBAL-VARIABLE
SET-VALUE
SHA1-DIGEST
SLIP
SPLIT
SQL
SQLFIRST
SQLLAST
SQLNEXT
SQLPREV
STATUS
TABLE (various)
TEXT
TIME
TIME-SECONDS
TFSCREATE
TFSATTACH
TFSUPDATE
TFSLINK
TFSGETURL
TOBASE64
TODAY
TOHEX
UNSECURE
UNZIP (<zip file name>.<folder to unzip to>)
UPDATE
USERGROUP
USERNAME
USER-PROFILE
UTCTIME
WEBFIRST
WEBLAST
WEBNEXT
WEBPREV
WEBSERVICE
WEEKDAY
WHILE
YEAR
ZIP

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

LAST-ACTION

Post by steve » Wed Jan 04, 2012 10:12 am

LAST-ACTION

Code: Select all

MESSAGE( LAST-ACTION ) 
vdc = LAST-ACTION 
vdd = LISTITEM( vdc , 3 , "$" ) 
MESSAGE( vdd )
Use this maths in the AFTER section of a master document letter template to programatically determine the correspondent for future use.

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

CALL-MATHS

Post by steve » Thu Jan 26, 2012 3:10 pm

CALL-MATHS (caseref,"Maths Field name")
run a maths item on any file
notes - not sure of the behaviour of case locking/PUT commands if you run maths on a file not locked to yourself. The maths field name needs to be enclosed not by curly brackets, but by "", and excluding the .Text ending. This command is useful for running a case-less SQL autoroutine that updates numerous other cases from one central autoroutine
WARNING: when searching for where database fields are used via Database Maintenance, the search results will NOT show the maths fields specified in CALL-MATHS. You will have to do a text string search via MATHS SEARCH

Example code:

Code: Select all

#run a maths field on a target case to update it with statistics
#our maths field when added with field chooser is {M update statistics.Text}
v-case = {Statistics file link.link case ref}
#TODO need to lock target case to ourselves here
CALL-MATHS (v-case, "M update statistics")

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

CALL-ACTION

Post by steve » Thu Jan 26, 2012 4:03 pm

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

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

PUTDATA

Post by steve » Thu Jan 26, 2012 4:05 pm

PUTDATA(caseref,{target field},value-to-put)
CAUTION: when using the "Maths Search", the code overview displays TWO opening brackets and only one close bracket. This does not reflect the underlying maths field content.

As above, useful for PUTting data to another case in the same claimtype you are currently working with, and for use in loops to update many child cases from one case-less autoroutine.
Example:

Code: Select all

#src 1-12-11
#PUT a value into a list of cases returned by a SQL search within the same claimtype
#1 - run SQL to return list of cases
#2 - use WHILE loop to iterate through the cases
#3 - use PUTDATA() to update each case with a fixed value
#-----
#define our static value we want to add to each case0
v-value = "TEST"
#run SQL to get the list of cases we want to update. Here we have previously made an SQL called "ALLFILES"
SQL("ALLFILES","")
#jump to first case returned by SQL
SQLFIRST
#set up our loop to iterate through all cases returned, until no more
WHILE return-value <> "?" DO 
   #check case isn't locked
   v-case = return-value
   STATUS (v-case)
   IF return-value = "available" then
      OPEN (v-case,"LOCK")
      PUTDATA(v-case,{Test text field.Text},v-value)
      UPDATE (v-case,"UNLOCK")
   ELSE
      message ("case ", v-case," locked - can't update")
   END
   #advance to next case   
   SQLNEXT
END

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

FIND-CASE

Post by steve » Wed Aug 22, 2012 10:52 am

cresult = FIND-CASE({field},"Criteria")
message (cresult)

result is either
caseref
LOCKED
MULTIPLE
or blank

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

ASC (char)

Post by steve » Fri Nov 16, 2012 8:02 pm

ASC (char)
converts a character into ascii code
useful for checking for invalid characters in input fields

Code: Select all

#initialise variable for holding output
v-out = "" 
#retrieve field that needs checking
v-in = {Accident Description.Text} 
#how many characters in it
    v-in-len = LENGTH( v-in )
#loop over each character, if the character is not a-z or A-Z  then replace it with a space 
    i = 0 
    WHILE i < v-in-len DO 
        i = i + 1 
#get one character at a time
        v-char = SPLIT( v-in , i , 1 ) 
#convert into ascii code
        v-asc = ASC( v-char ) 
#IF A-Z then do nothing
        IF v-asc >= 65 AND v-asc <= 90 THEN 
            #A-Z - do nothing
#if a-z then do nothing
        ELSEIF v-asc >= 97 AND v-asc <= 122 THEN 
            #a-z - do nothing
        ELSE 
#not a valid char. replace with space 
            v-char = " " 
        END 
#build output 
        v-out = TEXT( v-out ) + v-char 
    END 
result = v-out

DeborahMonks
Posts: 10
Joined: Thu Jan 02, 2014 3:00 pm
Has thanked: 7 times

CONFLICTCHECK

Post by DeborahMonks » Fri May 30, 2014 11:06 am

(Taken from Release Notes V3.2.11)

There is the ability to do a Conflict Check via a linked action Math command while in a case.

When the linked action is ran it will search for the correspondent if one exists and display the conflict results.

This is setup using the Math syntax below:

CONFLICTCHECK (<correspondent type>,<search text>)

The two parameters can either be in the form of merge fields or text/fixed values.

Any further syntax needed, i.e. PUT commands to indicate whether a check has been carried out, can be added as normal.
Please note that the correspondent type needs to be in speech marks, e.g.

Code: Select all
CONFLICTCHECK ( "ALL" , {Client.Name} )


The Syntax Check does not pick this up.

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

Re: LAST-ACTION

Post by steve » Tue Nov 11, 2014 1:50 pm

steve wrote:LAST-ACTION

Code: Select all

MESSAGE( LAST-ACTION ) 
vdc = LAST-ACTION 
vdd = LISTITEM( vdc , 3 , "$" ) 
MESSAGE( vdd )
Use this maths in the AFTER section of a master document letter template to programatically determine the correspondent for future use.
update Nov 2014
LAST-ACTION works fine for the AFTER maths of a document/memo created in MCH, but the last action is not updated with any actions called by Proclaim maths.
It only list actions performed in Main Case Handling.
e.g.:

Code: Select all

#send memo
SEND MEMO (001) TO (CLIENT) COST UNITS (1/00) DETAIL (test) CASE (CURRENT-CASE)
#query LAST ACTION - this fails to return the details of the above SEND MEMO
message (LAST-ACTION)
even if you place a MESSAGE (LAST-ACTION) in the AFTER MATHS of the SEND MEMO, if the memo is produced via code (linked action or maths) then LAST-ACTION is not updated.

The alternative would be to use FETCH in this circumstance.

Post Reply