[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: 39
Joined: Wed Nov 30, 2011 9:37 pm

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: 422
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 11 times
Been thanked: 43 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: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 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: 47
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: 375
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 75 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!

Post Reply