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

TABLE commands

Post by proclaimadmin »

TABLEAMEND
TABLECANCEL
TABLECLEAR
TABLECOMMIT
TABLECOPY
TABLECOUNT
TABLECREATE
TABLEDELETE
TABLEFIRST
TABLEGETCURRENT
TABLELAST
TABLENEXT
TABLEPREVIOUS
TABLEREFRESHALL
TABLEREFRESHCURRENT
TABLEREFRESHSELECTED
TABLERESET
TABLESAVE
TABLESELECT
TABLESELECTCOUNT
TABLESETCURRENT
TABLETRUECOUNT

revellbikes
Posts: 543
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 18 times
Been thanked: 56 times

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

Post by revellbikes »

Any examples of what they do?!

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

LISTITEM

Post by steve »

returns a character string from a list, based on an integer position

LISTITEM (list , element , character)

example

Code: Select all

vlist = "Monday,tuesday,wednesday,thursday,friday,saturday,sunday"
v1 = listitem(vlist,1,","{
message ("first day is ",v1)
#prints Monday
CAVEAT/BUG
If you use a field for defining your starting list, then do not use the comma delimiter as it doesn't work.

Code: Select all

#set up example alpha field with comma delimited text
put( "Monday,tuesday,wednesday,thursday,friday,saturday,sunday", {mytext field.Alpha})
#retrieve field into variable
vlist = TEXT( {mytext field.Alpha})
v1 = listitem(vlist,1,",")
#or v1 = listitem({mytext field.Alpha},1,",") - doesn't work either
vcount =listsize(vlist,",")
message ("Count: ",vcount) #returns 1!
message ("first day is ",v1) #errors: prints Monday,tuesday,wednesday,thursday,friday,saturday,sunday

Netwiseit
Posts: 52
Joined: Tue Apr 12, 2016 7:59 am
Has thanked: 11 times
Been thanked: 4 times

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

Post by Netwiseit »

Can an example of Rounding UP / Down be added and linked into the list of functions please.

Thanks in advance.

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

ROUND

Post by steve »

ROUND(variable , <decimalplaces> , <method>)
where <method>:
-1 = round down next digit
0 = if(digit >=5), round up, else round down
1 = round up to next digit

example:
round 11.26252 down to the nearest 2 decimal places

Code: Select all

vin = 11.26252
vout = ROUND( vin , 2 , -1 )
ROUND command is exceedingly picky about syntax and format
it MUST be input with spaces surrounding each parameter, namely:
ROUND( variable , decimalplaces , method)
ROUND([space][variable][space][comma][space][decimalplaces][space][comma][space][method][space])

[method] is as before:
-1 = round down next digit
0 = if(digit >=5), round up, else round down
1 = round up to next digit

If this layout is not followed, then the code will compile, but be corrupted upon compilation and not save. The danger is that you click ACCEPT without first CHECKing your code, and this will be saved with the corruption and no error. So always Syntax CHECK prior to saving!

BCC
Posts: 12
Joined: Wed Apr 26, 2017 10:28 am
Has thanked: 2 times
Been thanked: 2 times

GETDATA

Post by BCC »

Please delete if there is already one for this command, but I only came across this today, and found it to be very useful...

Code: Select all

        vcase = "100001" 
        OPEN( vcase , "LOCK" ) 
        v-max = GETDATA( vcase , {MED-Max Cases.Number} ) 
        v-num = GETDATA( vcase , {MED-Current Cases.Number} ) 
        #MESSAGE( "Current" v-num ) 
        #MESSAGE( "Max" v-max ) 
        IF v-num > v-max THEN 
            PUT( "01" , {MED- Provider.Code} )  
        ELSE 
            PUT( "02" , {MED- Provider.Code} ) 
            v-num = v-num + 1 
        END 
        PUTDATA( vcase , {MED-Current Cases.Number} , v-num ) 
        UPDATE( vcase , "" ) 
        UPDATE( vcase , "UNLOCK" )
 
Last edited by BCC on Thu May 16, 2019 9:49 am, edited 1 time in total.

proclaimadmin
Site Admin
Posts: 55
Joined: Wed Nov 30, 2011 9:37 pm
Has thanked: 1 time
Been thanked: 4 times

Re: GETDATA

Post by proclaimadmin »

thanks for the addition, greatly appreciated. I have added a link to the index for this.

Tardisgx
Posts: 31
Joined: Wed Jun 19, 2019 10:35 am
Has thanked: 10 times
Been thanked: 1 time

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

Post by Tardisgx »

CONTAINS and BEGINS are not in this list

Code: Select all

IF {Field.Text} CONTAINS "Bill" THEN
or if the word Bill will always be the first part of the field value then: IF {Field.Value} BEGINS "Bill" THEN

These can be further expanded if you then want:

Code: Select all

IF {Field.Value} BEGINS "Bill" OR {Field.Value} CONTAINS "Hill" OR {Field.Value} BEGINS "SomethingElse" THEN
Credit to @ISimpson viewtopic.php?t=815

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 »

Tardisgx wrote:
Wed Oct 28, 2020 4:49 pm
CONTAINS and BEGINS are not in this list
Thankyou - added.

Code Killer
Posts: 59
Joined: Thu Oct 29, 2015 10:04 am
Location: Kent
Has thanked: 40 times
Been thanked: 4 times

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

Post by Code Killer »

Hi All,

I've just triggered syntax highlighting for the keyword "NOT", I thought it might work like it does in Python eg.

Code: Select all

If NOT IN [12,23,13] THEN
The word "IN" doesn't get highlighted. :?:

Does anyone have any idea how it's used? :idea:

Thanks :D

Post Reply