[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: 40
Joined: Wed Nov 30, 2011 9:37 pm
Been thanked: 1 time

TABLE commands

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

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

revellbikes
Posts: 438
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 12 times
Been thanked: 45 times

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

Post by revellbikes » Tue Oct 23, 2018 12:12 pm

Any examples of what they do?!

steve
Posts: 393
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 82 times

LISTITEM

Post by steve » Fri Nov 09, 2018 2:53 pm

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: 48
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 » Sun Feb 03, 2019 2:19 pm

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

Thanks in advance.

steve
Posts: 393
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 82 times

ROUND

Post by steve » Mon Feb 04, 2019 9:08 am

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: 5
Joined: Wed Apr 26, 2017 10:28 am
Has thanked: 1 time

GETDATA

Post by BCC » Thu May 16, 2019 9:45 am

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

Re: GETDATA

Post by proclaimadmin » Thu May 16, 2019 9:48 am

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

Post Reply