411 REFERENCE · Wikibooks
DataPerfect/Functions
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
DataPerfect Functions Absolute Value Syntaxabs[arg]Related Functions Example Callabs[-5.73]DescriptionAbs is used to obtain the absolute (positive) value of a number (where arg = any G or H formatted number).Exampleabs[-1] -- Returns 1
abs[1] -- Returns 1
abs[45] -- Returns 45
abs[-45] -- Returns 45 Apply Text Format to Numeric Values Syntaxapply.format[arg1;arg2]Related Functions convertExample Callapply.format["N9999";year[today]]DescriptionApply.format is used to convert any numeric data type (formats N, G, H, D, and T) into alphanumeric (formats U and A) text where arg1 = the field format that the data is coming from and arg2 = the numeric to be converted.ExampleIf P1F1 is a numeric field with the format "N(999)999-9999" and has a value of 8003213249 then apply.format["N(999)999-9999";P1F1] will return the string "(801)321-3249". Bell SyntaxBell[arg]Related Functions Example CallBell[1]DescriptionThe Bell formula function will beep if the specified value is not empty or null.ExampleIf you have a field that is used to mark outdated records (blank if current, filled if outdated) and you want to verify that all records that are outdated have been deleted, you can run a report that checks that field and beeps if it encounters anything in that field. If all records are current, you won't hear any beeps during the report, but if something was left behind, the computer will beep. Concatenate, No Truncate Syntaxcat.c[arg1;arg2;...;argn]Related Functions cat.tExample Callcat.t[P1F1;1;apply.format["N99999";P1F5]]DescriptionCat.c is used to concatenate two or more character strings without truncating blank spaces. The arguments can be any string contained within quotes (either single (') or double (") quotes), a field/rv/formula containing alphanumeric data, or an integer indicating the number of carriage returns to insert into the text.ExampleIf P1F1 = "Hello" and P1F2 = "There" then cat.c[P1F1;" ";P1F2;" This is a test!"] will return the string "Hello There This is a test!". Concatenate, Truncate Syntaxcat.t[arg1;arg2;...;argn]Related Functions cat.cExample Callcat.t["This is a test";1;P1F1;rv0]DescriptionCat.t is used to concatenate two or more character strings, truncating blank spaces. The arguments can be any string contained within quotes (either single (') or double (") quotes), a field/rv/formula containing alphanumeric data, or an integer indicating the number of carriage returns to insert into the text.ExampleIf P1F1 = "Hello " and P1F2 = "There " then cat.t[P1F1;" ";P1F2;"This is a test! "] will return the string "HelloThereThis is a test!". Contains Syntaxcontains[arg1;arg2]Related Functions Example Callcontains[P1F2;"*DataPerfect*"]DescriptionContains searches alphanumeric and text fields for a specified string. Arg1 is the field/rv/string to be searched and arg2 is the string to be searched for. Returns the integer 1 if the search is successful or a 0 if it is not. Strings to be searched for should be enclosed in quotes if a hard-coded string; otherwise search strings may come from report variables or fields. Wild cards (asterisks or question marks) may be used to find strings within text in a field, otherwise the string searched for will have to be the only thing in the field.ExampleIf P1F1 = an alphanumeric or text field and "*sold*" is the search string, then contains[P1F1;"*sold*"] will return a 1 (true) if the string "sold" exists anywhere in P1F1 or 0 (false) if it does not.
If the string "sold*" is used, it will be found only if the string exists at the beginning of the field. Convert Text to Number Syntaxconvert[arg1;arg2]Related Functions apply.formatExample Callconvert["N9999";P1F1]DescriptionConvert is used to change character strings into numbers (G, H, T, D, or N format). Arg1 = the field format that the string is to go to while arg2 = a string value that is to be converted.ExampleIf P1F1 is an alphanumeric field and contains the string "123456" then
convert["G$ZZZ,ZZ9.99";P1F1] will return the numeric value 123456.00 (or $123,456.00 when displayed in the field). Date Syntaxdate[arg1;arg2;arg3]Related Functions date related functionsExample Calldate[day[P1F1];month[today];yearrv1DescriptionThe date function is used to combine three numbers representing a day (arg1), month (arg2) and year (arg3) into a single Julian date value (the total number of days since March 1, 1900).ExampleIf the function day[P1F1] returns a value of 19 and P1F2 contains the value 11 then date[day[P1F1];P1F2;1992] will return a value of 33,866, or a date of 1992.11.19. Day Syntaxday[arg]Related Functions day.of.week,month,yearExample Callday[today]DescriptionThe day function produces the day of the month (a number from 1 to 31) of the date stored in arg1 where arg1 is a field, report variable or the today function.ExampleIf P1F1 is a date field with the value 1992.11.19 then day[P1F1] will return the value 19. Day of Week Syntaxday.of.week[arg]Related Functions day, month, yearExample Callday.of.week[today]DescriptionThe day.of.week function produces the day of the week (a number from 1 to 7 where 1 = Monday and 7 = Sunday) of the date stored in arg1 where arg1 is a field, report variable or the today function.ExampleIf P1F1 is a date field with a value of 1992.11.19 then day.of.week[P1F1] will return the value 4 (Thursday). Exponent Syntaxexp[arg]Related Functions Example Callexp[2]DescriptionThe Exponentiation formula function (exp[x]) returns the logarithmic exponent of x (e^x).Exampleexp[2] returns 7.39 (approximately). First Day of Month Syntaxfirst.day[arg]Related Functions date, last.day, first.ndayExample Callfirst.day[P1F1]DescriptionThe first.day function returns the date of the first day of any given month (represented as "arg" above where arg = a value with a date format).ExampleP1F1 is a date field and has the value of 1992.11.19 then first.day[P1F1] will return a value of 1992.11.01 (November 1, 1992), the first day of November 1992. First Weekday of Month Syntaxfirst.nday[arg1;arg2]Related Functions date, first.day, last.dayExample Callfirst.nday[7;P1F1]DescriptionThe first.nday function returns the date of the first given weekday (represented by "arg1" above) of any given date (represented as "arg2"). Arg1 = a number from 1 (Monday) to 7 (Sunday) representing the days of the week. Arg2 = a value with a date format.ExampleIf P1F1 is a date field with the value 1992.11.19 then first.nday[4;P1F1] will return 1992.11.05 (November 5, 1992), the first Thursday of the month. Future Value Syntaxfv[i;pv;pmt;n;type]Related Functions pv, pmt, rateExample Callfv[(.08/12);-100;40;2;1]DescriptionThis function returns the future value based upon data provided [interest rate, present value, payment amount, number of periods, and type (0=investment/growth or 1=depreciation/loan)].ExampleIf you have a loan at 8%, your balance due is $100.00, you pay 40.00 per month, and you want to know your balance after 2 more payments, you would enter fv[.08/12);-100;40;2;1]; your balance after 2 payments will be $20.54 Initial Caps Syntaxicaps[text]Related Functions Lower CaseExample Callicaps[P2F3]DescriptionCapitalizes the first character of each word in fixed length alphanumeric and open-ended text fields.Exampleicaps["hello jane"] gives "Hello Jane"
icaps["JOHN JONES"] gives "JOHN JONES"
icaps[lower.case["JOHN JONES"] gives "John Jones" Last Day of Month Syntaxlast.day[arg]Related Functions date, first.day, first.ndayExample Calllast.day[P1F1]DescriptionThe last.day function returns the date of the last day of any given month (represented as "arg" above where arg = a field, report variable or formula that returns a date value).ExampleIf P1F1 is a date field and has the value 1992.11.19 then last.day[P1F1] will return a value of 1992.11.30 (November 30, 1992), the last day of November 1992. Last Weekday of Month Syntaxlast.nday[arg1;arg2]Related Functions date, first.day, first.ndayExample Calllast.nday[7;P1F1]DescriptionThe last.nday function returns the date of the last given weekday (represented by "arg1" above) of any given date (represented as "arg2"). Arg1 = a number from 1 (Monday) to 7 (Sunday) representing the days of the week. Arg2 = a value with a date format.ExampleIf P1F1 is a date field with the value 11/19/92 then last.nday[7;P1F1] will return 11/29/92 (November 29, 1992), the last Sunday of the month. Length of String Syntaxlength[arg]Related Functions Example Calllength["This is a test!"]DescriptionLength returns a number that is equal to the number of characters in any given string after truncating the trailing blanks. "Arg" can be a field, report variable or formula returning a string of characters. The maximum value of length[arg] is 78; there appear to be some problems in using length[] with text fields.Examplelength["Arizona "] returns a 7.
length["Ryan Davis"] returns a 10. Logarithm, Natural Syntaxln[arg]Related Functions Example Callln[11]DescriptionThe Logarithm formula function (ln[x]) returns the natural logarithm of the specified number (log of x to base e).Exampleln[11] returns 2.4 (approximately) Lower case Syntaxlower.case[arg]Related Functions Initial capsExample Calllower.case["LOWER CASE"]DescriptionConverts fixed length alphanumeric and open-ended text fields to all lower case characters.Examplelower.case["LOWER CASE"] returns "lower case" Maximum Value Syntaxmax[arg1;arg2;...argn]Related Functions minExample Callmax[P1F1;14;(3*7);rv0]DescriptionMax is used to extract the largest value from a range of values ("arg1," "arg2" and "argn" above). The arguments can be numeric OR string values, but both types should not be used in the same function. Max will extract the value of the argument with the highest value. Max is not case sensitive.Examplemax[sqrt[100];17;(4*3)] will return a 17.
max["Ray";"Kevin";"Craig";"Christi";"Rick";"Jill"] returns "Rick" Minimum Value Syntaxmin[arg1;arg2;...argn]Related Functions maxExample Callmin[P1F1;14;(3*7);rv0]DescriptionMin is used to extract the smallest value from a range of values ("arg1," "arg2" and "argn" above). The arguments can be numeric OR string values, but both types should not be used in the same function. Min will extract the value of the argument with the lowest value. Min is not case sensitive.Examplemin[sqrt[100];17;(4*3)] will return a 10.
min["Ray";"Kevin";"Craig";"Christi";"Rick";"Jill"] returns "Christi" Modulo Syntax//Related Functions roundExample Call10 // 3DescriptionReturns the remainder of a division equation.Example10 // 4 - Returns 2
10 // 3 - Returns 1
10 // 2 - Returns 0 Month Syntaxmonth[arg]Related Functions day, day.of.week, yearExample Callmonth[today]DescriptionThe month function produces the number of the month (a number from 1 (January) to 12 (December)) of the date stored in arg1 where arg1 is a field, report variable or the today function.ExampleIf P1F1 is a date field with a value of 1992.11.19 then month[P1F1] will return an 11 (November). Now SyntaxnowRelated Functions todayExample CallnowDescriptionNow is used to retrieve the system time (returned as the number of seconds since 12a) from the computer's internal clock.ExampleIf the system time is 16:53:34 (4:53p) then now will return 60,814, or 16:53:34 in a time (T99:99:99) formatted field. Payment Syntaxpmt[i;pv;n;fv;type]Related Functions pv, fv, rateExample Callpmt[(.075/12);-4000;24;0;1]DescriptionThis function returns your payment based upon the data provided [interest, present value, number of periods, future value, type (0=investment/growth or 1=depreciation/loan)].ExampleTo learn how much you need to pay each month to retire a $4000 loan at 7.5 interest in 2 years, you would enter pmt[(.075/12);-4000;24;0;1] (you will need to make monthly payments of $178.88). Power Syntax^Related Functions sqrtExample Call10^2DescriptionRaises a value to the given exponential power.Example10^2 - Returns 100
10^3 - Returns 1000
10^4 - Returns 10000 Present Value Syntaxpv[i;pmt;n;fv;type]Related Functions pmt, fv, rateExample Callpv[(.06/12);0;240;500000;0]DescriptionThis function returns the present value based upon the data provided [interest rate, payment amount, number of payments, future value sought, and type (0=investment/growth or 1=depreciation/loan)].ExampleTo learn how much money you will need to deposit into a savings account so that, without depositing any more money, you will have $500,000 in the bank in 20 years (assuming you're guaranteed 6% interest), you can enter pv[(.06/12);0;240;500000;0]. You will find that $151,048.07 will grow to $500,000 in 20 years at 6% interest. Rate SyntaxRate[pv;pmt;n;fv;type]Related Functions pv, pmt, fvExample Callrate[-500;50;12;600;1]DescriptionThe function returns the effective interest rate based upon the data provided [present value, payment amount; number of payments, future value, and type (0=investment/growth or 1=depreciation/loan)].ExampleTo learn the interest rate you were charged after you made 12 $50 payments on a 12-month, $500 loan, you will enter rate[-500;50;12;600;1] (you paid a little over 12% interest). Round Syntaxround[arg1;arg2]Related Functions //Example Callround[P1F1;.25]DescriptionRounds a number to the nearest indicated value where arg1 = the numeric (G or H format) value to be rounded and arg2 = the value to round up/down to.Exampleround[4.5;1] - Returns 5.
round[54.123432;.001] - Returns 54.123
round[55.345;.25] - Returns 55.25
round[12347;50] - Returns 12350 Square Root Syntaxsqrt[arg]Related Functions ^ (power)Example Callsqrt[(rv1*5)]DescriptionComputes the square root of the absolute value of a number (i.e. if the number is negative, it is first made positive) where arg = a number (G or H format) field, report variable, formula or value to find the square root of.Examplesqrt[4] - Returns 2.
sqrt[65.3] - Returns 8.08.
sqrt[-65.3] - Returns 8.08. Subfield Syntaxsubfield[arg1;arg2;arg3]Related Functions Example Callsubfield[P1F1;" ";1]DescriptionProduces the nth word (determined by the value in arg3) in the string (arg1) if the mask (arg2) is empty or " ". Produces the nth (arg3) word bracketed by any of the characters in the mask (arg2).Examplesubfield["Christine C. Babbitt";" ";2] returns a value of "C.".
subfield["(602) 123-4567";'- )(';1] returns a value of "602".
(Note that the number shown is considered text, not an N, G, or H value.) Substring Syntaxsubstring[arg1;arg2;arg3]Related Functions apply.formatExample Callsubstring[P1F1;2;14]DescriptionReturns a specified number of characters from a text string starting at a specified location in the string. (Where arg1 = the field, report variable, formula, or text string to pull the new string from; arg2 = the starting location to parse from; and arg3 = the number of characters to cut out of the string.)
If you enter a value of 1 or more for arg2, DataPerfect starts counting at the left of the string and counts from left to right. If you enter a value of 0 for arg2, DataPerfect counts characters from right to left.Examplesubstring["Example";3;5] will return "ample"
If P1F2 = a numeric field formatted N(999)999-9999 with a value of 8003213249 then substring[apply.format["N(999)999-9999";P1F2];2;3] will return 800 (the area code).
substring[" 215 Oak Lane, Hartford, CT";0;2]
This formula will return the string "CT" Term Syntaxterm[i;pv;pmt;fv;type]Related Functions pmt, pv, fv, rateExample Callterm[(.05/12);0;165;-1000;0]DescriptionThis function returns the number of periods (remaining or projected), based upon the data provided [interest rate, present value, payment amount, future value, and type (0=investment/growth or 1=depreciation/loan)].ExampleTo learn how long it will take you to save $1000 of you deposit $165 per month and earn 5% interest (and start with a zero balance), you would enter term[(.05/12);0;165;-1000;0)] (you will have a little over $1000 in 6 months). Today SyntaxtodayRelated Functions nowExample CalltodayDescriptionToday returns the system date (from the computer's internal clock) in a Julian numeric format (i.e. the number of days since March 1, 1900. When stored in a date field format this number is automatically translated to the appropriate month/day/year. The today function is generally used as arguments in other functions and formulas.ExampleIf the system date is 11 Nov 92 then today will return 33,866, or 1992.11.19 in a date (DYMD9999.99.99) formatted field. Truncate Syntaxtruncate[arg]Related Functions cat.tExample Calltruncate[P1F1]DescriptionTruncate removes all trailing spaces from a character string.Exampletruncate["Shauna "] will return "Shauna."
A text string can be created by using consecutive truncate functions (i.e. truncate[P1F2] truncate[P1F3]) but it is generally best to use the cat.t function instead. Unary Minus Syntax-Related Functions Example Call-P1F1DescriptionReturns the negative value of any number.ExampleIf P1F1 = 10 then -P1F1 returns -10.
If today = 1992.11.19 then -today returns -33,866.
(This is good for sorting records with the most recent date to the top of the list. See "Reverse Date" in the formulas section of this database.) Year Syntaxyear[arg]Related Functions day, day.of.week, monthExample Callyear[P1F1]DescriptionYear returns the 4 digit year (i.e. 1992) in a numeric format from a date value.ExampleIf P1F1 is a date field with the value 1992.11.19 then year[P1F1] will return the numeric value 1992 which could then be stored in an N9999 field.
Some other acceptable formats include the following: year[rv1], year[date[19;11;1992]] and year[today]. Source notes
This wiki page was generated from the DataPerfect FORMULA database.