F3293EvaluateDerivedCalculation

F3293 Evaluate Derived Calculation

Minor Business Rule

Object Name: B3200500

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This business function evaluates the Derived Calculation or Smart Part Calculation passed in as input 
and returns the interpreted value as either a numeric value or an alphanumeric string.  The input 

text string (i.e. either Derived Calculation or Smart Part):

1. may or may not contain parentheses to establish precedence; standard rules    of precedence 
should be used when interpreting the rule.

2. may interpret to a character string value or to a numeric value.  


Here are some examples of valid Derived Calculations or Smart Part input text strings:

1. 'X''COS'S10 (interprets to string value of  "XCOS9000" if Segment 10 = 9000)
2. SUBSTR(EXTVAR,4,10)'ITM'S20CONTCAT(S20,&IMAITM)

3. 89*ORDQTY+&BPUPRC/EXTVAR*(10*S30=COMPUTER=/2)

4. SIN(S20=COMPUTER=)/&T2AMTU(WD)


1.2Setup Notes and Prerequisites

None

1.3Special Logic
None

2.Technical Specifications
2.4Processing 
A.Delimiters:
The following values should be setup as symbolic constants (#DEFINE) in the header file so they can 

be easily changed later:

1)Segment Identifier  -  S
2)Externally Defined Identifier -  &

3)Multi-level reference segment identifier -   =

4)Substring identifer - SUBSTR

5)Concatenation identifier - CONCAT

6)External Variable identifier - EXTVAR

7)Quote identifier - '

8)Order Quantity identifier - ORDQTY


B.Extract Literals:

1)Extract any values which are enclosed with the Quote Identifier (e.g. ') and save these values 
and their starting positions.  These literal values will be returned to the text string later; they 

are extracted here to avoid interference with any scans on the text string for specific 

identifiers.  The Quote Identifiers can be left in the string as a "placeholder" for inserting the literal 

values back in the string later in this processing.


C.Interpret External Fields:

1)Extract any external fields.  The extraction begins with externally defined identifier, A.2 
above, and ends with a  +, -, *, /,  ), (, blank, Quote identifier, or comma.

2)For each field found, retrieve the value by calling F3293 Evaluate External Data Items 

(B3200510)
 and replace the identifier and field name with the returned value, e.g. &IMITM will be replaced 
with an item number from F4101.


D.Insert Segment Values:

1)Extract the segment number from the text string:
a)Scan for an the Segment Identifiers (A.1 above) followed by a digit 0-9.
b)Extract the segment number.  Retrieve all digits 0-9 after the "S" and before the next 

non-numeric character, e.g. S20 or S1 or S78.

2)Evaluate the Segment value:
a)Extract any multi-level references; these will be enclosed in the Multi-level reference 
segment identifier (A.3. above), e.g. =COMPUTER=. 

b)Extract the item number from between the multi-level reference identifiers.  Retrieve the 

short item number for the extracted item by calling Get Item Master Row (X4101)

c)If the Call Type = '1', read the Segment Values cache using Cache, Process Segment Values 

(B3200350)
 to retrieve the segment value. 
i.LNID = Use Sales Order Line number (LNID) value.
ii.ITM = If there was a multi-level reference, use the short item number retrieved in the 

previous step (D.2.b); otherwise, use the Parent item (KIT) value passed in as input.

iii.MCU = MCU (Branch/Plant of parent item) input parameter

iv.PEL = Segment number extracted from the derived calculation (See step #1 above) 

d)If the Call Type is '2' or '3', retrieve the value from F3294 and F32942.
i.Read F3294 with DOCO, DCTO, KCOO, and LNID input parameters.
ii.If a record is found, use the CSID field to read F32942 with the following key values:

'b7CSID = CSID field from P3294 
'b7KIT = KIT field from F3294

'b7ITM = KIT from input parameters 

'b7PEL = Segment number extracted from the derived calculation

3)Replace the segment identifiers and multi-level (e.g. S10=COMPUTER=) identifiers in the derived 
calculation with the retrieved value.


E.Interpret Order Quantity:

1)Extract any Order Quantity references by scanning the derived calculation for the "Order 
Quantity Identifier" (A.8 above).

2)Replace the Order Quantity identifier ("ORDQTY") with the Quantity (QTY) value passed in as 

input.


F.Interpret Substring Command:e.g. SUBSTR(Pabcd,0,1)

1)Find the Substring identifier (A.4 above).
2)Extract the string to be parsed (e.g. "Pabcd" in above example); string will begin with a "(" 

and be terminated with a comma.

3)Extract the beginning position of the string (e.g. "0" in above example; begins with the comma 

ending the string and ends with another comma.

4)Extract the length of the string (e.g. "1" in above example); begins with the comma and ends 

with ")".

5)Perform the substring operation.

6)Insert the result into the derived calculation replacing the Substring identifier, and all 

parameters and parentheses associated with the substring command.


G.Interpret Concatentation:                 e.g. CONCAT(Hello,World)

1)Find the Concatenation identifier (A.5 above).
2)Extract the first string (e.g. "Hello" in above example); string will begin with a "(" and be 

terminated with a comma.

3)Extract the second string (e.g. "World" in above example); begins immediately after the comma 

and ends with  ")" 

4)Perform concatenation operation with zero blanks assumed between the two strings.

5)Insert the result into the derived calculation replacing the Concatenation identifier, and all 

parameters 


H.Interpret External Variable (from external program call):

Note:  The external program must be able to access the following cache by calling the appropriate 

business function:

Segment ValuesB3200350
Configured ComponentsB3200360

All ComponentsB3200370

Text StringB3200380

RoutingsB3200390

Price CostB3200400

1)Find the External variable identifier (A.6 above).
2) Setup the data structure for the external program.  All external programs should use the same 

standard data structure (see "Data Structure for External Program" specifications at beginning of 

this document):

a)ITM = Component Item (ITM) if not zeros; else, use Parent Item (KIT)
b)MCU = Component Branch/Plant (CMCU) if Component Item (ITM) is not zeros; else, use 

Parent Branch/Plant (MCU).

c)EXVR = 30 character output field from the external program

d)Sales order parameters (see data structure for external program layout).

3)Retrieve external function program name from F9862 with external program ID.
4)If the external function name is retrieved, use jdeCallObject to retrieve External Program 

Value.

5)Remove blanks from the EXVR value returned.

6)Insert the result into the derived calculation replacing the External Variable identifier (A.6 

- EXTVAR).


I.Interpret Trigonometric and Logarithmic functions:                 e.g. COS(100.23)

1)Find any of the following trigonometric or logarithmic functions in the text string:
   Identifer    Function to perform
SINSine
COSCosine

TANTangent

ARCArctangent

LOGLog to base 10

LNNatural log

**Exponents, e.g. 2**5 is 2 to the 5th power

SQRSquare Root

SGNChange sign of number

ABSAbsolute value of number


2)Extract the argument for the function from between the parentheses which follow the identifier. 
(e.g. "100.23" in above example); argument will begin with a "(" and be terminated with a ")".  

3)Perform the operation associated with the trigonometric or logarithmic function.

Insert the result into the derived calculation replacing the function identifier (e.g. "COS"), the 

argument, (e.g. 100/3.4*(6.78**3)) and the parentheses surrounding the argument.


J.Insert Literals:

1)Before returning literals to the text string, if the "Convert to Numeric" input parameter is 
"0", remove any algebraic operators from the interpreted string (e.g. +, *, etc).  Note:  If these 

operators have been defined as literals, they should be returned to the string in the next step just 

like any other literal character.

2)Return any previously extracted literal values back into their correct positions in the text 

string.

3)The Quote Identifiers (e.g. ') being used as placeholders should be replaced by the inserted 

literals.


K.Evaluate numeric derived calculation:

1)If the "Convert to Numeric" input parameter is "1":
a)Call CALCIT B0000500 to calculate evaluated string.
b)If there are no errors, return the numeric value passed back from this function to the 

calling program in the numeric return field and set the Numeric Value Indicator to "1".

2)If "Convert to Numeric" input parameter is "0", return the interpreted string back to the 
calling program in the string return field and set the Numeric Value Indicator to "0".


Thi function will be used to evaluate the Derived Calculation or Smart Part Calculation passed in as 

input and returns the interpreted value as either a numeric value or a string value.

^

Data Structure

D3200500 - F3293 Evaluate Derived Calculation

Parameter NameData ItemData TypeReq/OptI/O/Both
cCallTypeEV01charOPTNONE

An option that specifies the type of processing for an event.

szDerivedCalculationDERCcharOPTNONE

An algebraic formula that specifies the quantity, price, hours, or a value associated with a rule. The following examples illustrate the syntax 
for possible derived calculations: Segment References     o S3 indicates segment 3.     o S3=Piston= indicates segment 3 in item 
Piston. Trigonometric and Logarithmic Functions     o SIN(20) indicates the sine of 20.     o COS(S3) indicates the cosine of segment 3.     o TAN(S4) indicates 
the tangent of segment 4.     o ARC(S3) indicates the arctangent of segment 3.     o LOG indicates log to base 10.     o LN indicates natural log.    
 o 2**5 indicates an exponent, 2 to the fifth power. Substring SUBSTR(S10,1,4) indicates that the substring from segment 10 starts at the first 
position of the string and includes the first 4 positions. Concatenations CONCAT(S3,S4) combines the values of segments 3 and 4. External 
Fields Specifies the fields from non-configurator tables that you want the system to access as part of a calculation. Use the ampersand character 
followed by the field name. For example, &T2AMTU(WD) indicates an amount field in the Item Supplemental Database table, and the WD 
data type. External Programs Specifies that a program external to the system is to be used for the calculation. Enter the name of the external 
program and EXTVAR in the Derived Calculations field. Smart Parts PS4 indicates a smart part number P2000 when the value of segment 4 is 
2000.

cConvertToNumericEV01charOPTNONE

An option that specifies the type of processing for an event.

szParentBranchPlantMCUcharOPTNONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

mnConfiguredParentItemKITMATH_NUMERICOPTNONE

The system provides for three separate item numbers.    1.   Item Number (short) - An eight-digit, computer assigned, completely 
non-significant item number.    2.   2nd Item Number - The 25-digit, free form, user defined alphanumeric item number.    3.   3rd Item Number - Another 
25-digit, free form, user defined alphanumeric item number.

mnSegmentNumberPELMATH_NUMERICOPTNONE

A number that establishes the sequence in which the segments were defined in the system. Segment numbers are user 
defined. Cross-segment editing rules reference the segment numbers to ensure that the set of values defines a valid configuration. Assembly inclusion rules 
reference segment numbers and their associated values to define prices, component parts, routing, and calculated values for configured items.

szComponentBranchCMCUcharOPTNONE

A secondary or lower-level business unit. The system uses the value that you enter to indicate that a branch or plant contains several 
subordinate departments or jobs. For example, assume that the component branch is named MMCU. The structure of MMCU might be as follows:    
Branch/Plant - (MMCU)       Dept A - (MCU)       Dept B - (MCU)       Job 123 - (MCU)

mnComponentItemITMMATH_NUMERICOPTNONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

szExternalProgramIDEPGMcharOPTNONE

The name of the external program written by your MIS department, that will be providing values for external variables.

mnNumericReturnValueMATH01MATH_NUMERICOPTNONE

- - - Good Performance Low Value. 

szStringReturnValueDS80charOPTNONE

A free-form text field for comments or memoranda.

cNumericValueIndicatorEV01charOPTNONE

An option that specifies the type of processing for an event.

szOrderBranchPlantMCUcharOPTNONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

mnOrderTransactionQtyQTYMATH_NUMERICOPTNONE

The number of units associated with an asset.

mnOrderNumberDOCOMATH_NUMERICOPTNONE

A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry, 
and so on.

szOrderTypeDCTOcharOPTNONE

A user defined code (00/DT) that identifies the type of document. This code also indicates the origin of the transaction. J.D. Edwards has 
reserved document type codes for vouchers, invoices, receipts, and time sheets, which create automatic offset entries during the post 
program. (These entries are not self-balancing when you originally enter them.) The following document types are defined by J.D. Edwards and 
should not be changed: P Accounts Payable documents   R Accounts Receivable documents   T Payroll documents   I Inventory documents  
O Purchase Order Processing documents   J General Accounting/Joint Interest Billing documents   S Sales Order Processing documents

szOrderCompanyKCOOcharOPTNONE

A number that, along with order number and order type, uniquely identifies an order document (such as a purchase order, a contract, a 
sales order, and so on). If you use the Next Numbers by Company/Fiscal Year facility, the Automatic Next Numbers program (X0010) uses the 
order company to retrieve the correct next number for that company. If two or more order documents have the same order number and order 
type, the order company lets you locate the desired document. If you use the regular Next Numbers facility, the order company is not used to 
assign a next number. In this case, you probably would not use the order company to locate the document.

mnJobNumberJOBSMATH_NUMERICOPTNONE

The job number (work station ID) which executed the particular job.

mnUnitPriceResultUPRCMATH_NUMERICOPTNONE

The list or base price to be charged for one unit of this item. In sales order entry, all prices must be set up in the Item Base Price File table 
(F4106).

cSuppressErrorMessageEV01charOPTNONE

An option that specifies the type of processing for an event.

szErrorMessageIDDTAIcharOPTNONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

mnConfigurationIDNumberCFGIDMATH_NUMERICOPTNONE

An identifier that represents a unique configuration. It is generated by a next number value and is the key to the configuration tables.

mnComponentIDNumberCFGCIDMATH_NUMERICOPTNONE

A number that represents a component in a configuration. This number, which is generated by next numbers, always restarts at 1 and 
increments, based on the number of components in the configuration.

cCurrencyConversionCRYRcharOPTNONE

A code that specifies whether to use multi-currency accounting, and the method of multi-currency accounting to use: Codes are:    N Do not 
use multi-currency accounting. Use if you enter transactions in only one currency for all companies. The multi-currency fields will not appear 
on forms. The system supplies a value of N if you do not enter a value.    Y Activate multi-currency accounting and use multipliers to convert 
currency. The system multiplies the foreign amount by the exchange rate to calculate the domestic amount.    Z Activate multi-currency 
accounting and use divisors to convert currency. The system divides the foreign amount by the exchange rate to calculate the domestic amount.

cOrderModeMODEcharOPTNONE

The processing mode used in Purchase Order Consolidator to signify when specific orders are being processed.

szOrderLineTypeLNTYcharOPTNONE

A code that controls how the system processes lines on a transaction. It controls the systems with which the transaction interfaces, such as 
General Ledger, Job Cost, Accounts Payable, Accounts Receivable, and Inventory Management. It also specifies the conditions under 
which a line prints on reports, and it is included in calculations. Codes include the following: S Stock item   J Job cost   N Nonstock item   F Freight  
T Text information   M Miscellaneous charges and credits   W Work order

szOrderTransactionUOMUOMcharOPTNONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

szCurrencyCodeDomesticCRCDcharOPTNONE

A code that identifies the currency of a transaction. 

szSaleOrderVersionVERScharOPTNONE

A user-defined set of specifications that control how applications and reports run. You use versions to group and save a set of user-defined 
processing option values and data selection and sequencing options. Interactive versions are associated with applications (usually as a 
menu selection). Batch versions are associated with batch jobs or reports. To run a batch process, you must choose a version.

mnOrderAddressBookNoAN8MATH_NUMERICOPTNONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

jdOrderRequestDateDRQJJDEDATEOPTNONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

jdOrderShipDatePDDJJDEDATEOPTNONE

The promised shipment date for either a sales order or purchase order. The Supply and Demand Programs use this date to calculate 
Available to Promise information. This value can be automatically calculated during sales order entry. This date represents the day that the item 
can be shipped from the warehouse.

cFixedOrVariableQuantityFOVQcharOPTNONE

Reserved by J.D. Edwards A code that specifies whether the quantity of a configured item varies according to the quantity of the parent item 
produced or is fixed regardless of the parent quantity. Valid values are: F Fixed quantity V Variable quantity

Related Functions

B3200350 Cache Process Segement Values
B3200370 Cache Process All Components
B3200390 Cache Process Routings
B3200400 Cache Process Price Cost
B3200510 F3293 Evaluate External Data Items
X4101 Validate and Retrieve Item Master

Related Tables

F32942 Needed for upgrade from Xe and below
F32943 Needed for upgrade from Xe and below
F9862 Object Librarian - Function Detail