Edit

Lookup (code, fieldname)

Result Type: depends on type of field identified by fieldname.

Definition: Returns the value of the field identified by fieldname, where fieldname is a string of the form "file.field" which identifies a field in one of the MoneyWorks database files. MoneyWorks finds the record in the file whose code matches the code parameter and returns the value of the requested field from that record. The files which can be looked-up are: Account, Department, Names, Product, Job, Login, User and TaxRate. Transaction and BankRecs can also be looked up, but only by specifying a sequencenumber for the fieldname. A lookup on the Log file will always return the latest entry for a valid key. The fields available are those listed in Appendix A—Field Descriptions. The Find function offers a more flexible form of lookup based on a MoneyWorks search expression.

Examples:  Lookup("BANK1", "Account.Description")

returns “Main Bank Account” (assuming that account exists and has that name).

Lookup(If(PositionInText(Detail.Account, "-"), Left(Detail.Account, PositionInText (Detail.Account, "-") - 1), Detail.Account), "Account.Description")

returns the account description of the account code in the current detail line. The somewhat complex first argument extracts the basic account code, since the Detail.Account field may have a department suffix. You could use a similar technique to extract the department code and look up the department description.

Lookup("N", "TaxRate.Rate2" )

returns 12.5, which is the current GST rate.

Lookup("CUR/USD", "Offledger.Description")

Returns the description of the Currency “USD”. Note that for the Offledger file, the key is KIND/NAME. User entered records have a kind of “USR”.