numsandwich(
numsandwich(
PRIMARY
,
EXTRA
)

The numsandwich( function is similar to the sandwich function, but for numbers. If the value is zero the result is zero, but if the value is not zero the result is the value plus the extra.

Parameters

This function has two parameters:

primary – primary numeric value

extra – extra numeric value

Description

This function is similar to the sandwich function, but for numbers. If the primary value is zero the result is zero, but if the primary value is not zero the result is the primary value plus the extra value. For example, this could be useful for calculating the size of an object plus a border. If the object size is zero, the border is omitted also.

    numsandwich(20,10) ☞ 30
    numsandwich(0,10) ☞ 0

Note: This function is equivalent to:

    ?(value<>0,value+extra,0)

See Also

- - -- subtracts the numeric value on the right from the numeric value on the left.
- * -- multiplies the numeric value on the left by the numeric value on the right.
- / -- divides one numeric value by another.
- \ -- performs integer division.
- ^ -- raises a number to a power.
- + -- works differently depending on the type of operands used with it. If both operands are numeric, it does numerical addition. If either operand is text the + operator concatenates (joins together) the two operands.
- < -- compares two values to see if the first value is less than the second value.
- <= -- compares two values to see if the first value is less than or equal to the second value.
- <> -- compares two values to see if they are different.
- = -- compares two values to see if they are the same.
- > -- compares two values to see if the first value is greater than the second value.
- >= -- compares two values to see if the first value is greater than or equal to the second value.
- abs( -- calculates the absolute value of a number.
- alphabeticnumber( -- converts a number into letters: A, B, C, etc.
- and -- returns true if both operands are true.
- arccos( -- calculates the inverse cosine of a numeric value.
- arccosh( -- calculates the inverse hyperbolic cosine of a numeric value.
- arcsin( -- calculates the inverse sine of a numeric value.
- arcsinh( -- calculates the inverse hyperbolic sine of a numeric value.
- arctan( -- calculates the inverse tangent of a numeric value.
- arctanh( -- calculates the inverse hyperbolic tangent of a numeric value.
- arraycommonprefix( -- finds the common prefix (if any) of all items in an array.
- between( -- checks to see if a value is between two other values.
- bit( -- converts a bit number (1 to 64) into a number (1, 2, 4, 8, 16, etc.)
- ceil( -- converts a number to an integer, truncating toward positive infinity.
- chart( -- converts a table of data into an HTML page with a chart (bar, line, pie, etc.).
- cos( -- calculates the cosine of an angle.
- cosh( -- calculates the hyperbolic cosine of a numeric value.
- count( -- counts all non-empty instances of a line item field in the current record.
- crosstab( -- converts information in a database into a crosstab table (tab delimited text).
- degrees2radians( -- converts an angle from degrees to radians.
- degreestoradians( -- converts an angle from degrees into radians
- divzero( -- divides two numbers, returns zero if denominator is zero.
- divzeroerror( -- divides two numbers, returns an error if the denominator is zero.
- eulersnumber( -- returns the value of Euler's number.
- fact( -- computes the factorial of a value.
- fix( -- converts a number to an integer, truncating toward zero.
- fixed -- converts a floating point number to fixed point.
- float( -- converts a fixed point number to a floating point number.
- fv( -- (short for *future value*) calculates the future value of an investment.
- getbit( -- returns the value of a bit within a number.
- groupseq( -- returns the sequence number within a summary level.
- hexbyte( -- converts a limited range of decimal numbers to a two-digit hexadecimal number expressed as a text string.
- hexlong( -- converts a decimal number to an eight-digit hexadecimal number expressed as a text string
- hexstr( -- converts a number to text formatted as a hexadecimal number.
- hexword( -- converts a decimal number to a four-digit hexadecimal number expressed as a text string.
- info("defaultfloatformat") -- returns the default format for converting floating point numbers to text.
- int( -- converts a number to an integer, truncating toward negative infinity.
- latlongdistance( -- calculates the distance between two points on the earth (or any other sphere).
- length( -- counts the number of characters in a text value (also called a string).
- limit( -- checks to see if a value is between a minimum and maximum value. If it is, the value is returned unchanged. If it is below the minimum, the minimum value is returned. If it is above the maximum the maximum value is returned.
- log( -- computes the natural logarithm (base e ) of a value.
- log10( -- computes the common logarithm (base 10) of a value.
- makeinteger( -- makes a random integer with up to the specified # of digits (may be less).
- max( -- compares a series of values and returns the largest value.
- min( -- compares a series of values and returns the smallest value.
- mod -- computes the remainder (modulo) after integer division.
- monthmath( -- takes a date and computes the date that is one or more months before or after the original date.
- not -- reverses a boolean value.
- not( -- reverses a Boolean value
- notbetween( -- checks to see if a value is *not* between two other values.
- onescomplement( -- returns the one's complement of a 64 bit number (all bits are reversed)
- or -- returns true if either operand is true, or false if both are false.
- pi( -- returns the value of pi .
- pmt( -- (short for *payment*) calculates the periodic payment required to pay off a loan.
- pv( -- (short for *present value*) calculates the present value of an income or debit stream of payments.
- radians2degrees( -- converts an angle from radians to degrees.
- radianstodegrees( -- converts an angle from radians to degrees.
- radixstr( -- converts a number into a text item containing the equivalent number in a radix between 2 and 36.
- randominteger( -- generates a random integer between the starting and ending values.
- replacemultiple( -- replaces multiple words and phrases in a text value.
- rnd( -- generates a random number between 0 and 1.
- round( -- rounds a number to a specified increment.
- setbit( -- sets or clears one bit within a number, without disturbing any of the other bits.
- setdefaultfloatformat -- sets the default format for converting floating point values to text (unsupported).
- sin( -- calculates the sine of an angle.
- sinh( -- calculates the hyperbolic sine of a numeric value.
- sqr( -- calculates the square root of a value.
- str( -- converts a number into text, with no formatting.
- sum( -- adds up all instances of a line item field in the current record.
- tagparameterarray( -- extracts the value of multiple tag parameters embedded in some text, where each tag parameter takes the form *name=value*.
- tan( -- calculates the tangent of an angle.
- tanh( -- calculates the hyperbolic tangent of a numeric value.
- val( -- converts text into a number.
- xor -- returns true if one of the two parameters is true, false if neither or both are true.
- zeroblank( -- tells Panorama to treat zeroes as empty space.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.