Datalab funkcije
CallQRBeforeBandPrint
The procedure CallQRBeforeBandPrint calls program code in PANTHEON written for this band. It is written in the band's event OnBeforePrint.
Header
procedure CallQRBeforeBandPrint(Sender: TfrxComponent; var PrintBand: Boolean);
Example
procedure TitleOnBeforePrint(Sender: TfrxComponent);
begin
CallQRBeforeBandPrint(Sender, TfrxBand(sender).visible);
end;
dlBoolToYesNo
The function dlBoolToYesNo returns 'Yes' if the parameter value is True otherwise returns 'No'.
Header
function dlBoolToYesNo(bCondition: Boolean): String;
Example
On service statement reports returns whether an item is under warranty.
[dlBoolToYesNo(<qReportIzpis."anWarrenty"> = 'T')]
dlDiv
The function dlDiv returns the quotient of two numbers if the second parameter does not equal 0. If the second parameter equals 0, it returns 0.
Header
function dlDiv(nNum1, nNum2: Real): Real;
Example
[dlDiv(<qReportIzpis."anQty">, <qReportIzpis."anUMToUM2">)]
dlDPAExecute
The function dlDPAExecute runs a PANTHEON applet (DPA). Parameter is ID of DPA.
Header
procedure dlDpaExecute(cKey: String);
Example
dlDpaExecute('A000042');
dlGetCurrentUserID and dlGetCurrentUserName
The function dlGetCurrentUserID returns the current user’s ID.
The function dlGetCurrentUserName returns the current user’s name.
Headers
function dlGetCurrentUserID: String;
function dlGetCurrentUserName: String;
Example
Current user:
[dlGetCurrentUserID] - [dlGetCurrentUserName]
dlGetKeyViewFromKey
The function dlGetKeyViewFromKey converts an unformatted document key to a formatted one depending on the administrative panel settings.
Header
function dlGetKeyViewFromKey(cKey: String);
Example
[dlGetKeyViewFromKey(<qReportIzpis."acKey">)]
dlGetPostCode
The function dlGetPostCode returns the postal code without a prefix or a postfix.
Header
function dlGetPostCode(cKey: String);
Example
[dlGetPostCode(<qReportIzpis1."acPost">)]
dlGetSaldoStr
The function dlGetSaldoStr converts the number to notation with the character D (meaning debit) or C (meaning credit) at the end. It is used in the Demeter (Finance) module.
If the first parameter is greater than 0, returns the first parameter and the character D at the end.
If the first parameter is smaller than 0, returns the absolute value of the first parameter, and the character C at the end.
If the first parameter is 0 and the second parameter is B, returns the text 'BALANCED'.
If the first parameter is 0 and the second parameter is NOT B, returns the second parameter.
Header
function dlSaldoStr(nSaldo: Currency; cStr: String): String;
Examples
[dlSaldoStr(nSaldo,'0')]
[dlSaldoStr(SUM(<qReportIzpis."anDebit"> - <qReportIzpis."anCredit">),'B')]
dlGetTempDirectory
The function dlGetTempDirectory returns the temporary Windows directory. This is convenient when working with files because it is the only folder in which writing and reading files is always possible.
Header
function dlGetTempDirectory: String;
Example
Windows temporary directory: [dlGetTempDirectory]
dlLoadCompanyImage
The procedure dlLoadCompanyImage loads your company logo defined in the administrative panel into a picture object on printout.
Header
procedure dlLoadCompanyImage(Picture: TfrxPictureView);
Example
Put the picture object named Picture1 onto an arbitrary printout and write in its the event OnBeforePrint:
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
dlLoadCompanyImage(Picture1);
end;
dlLoadProductImage
The procedure dlLoadProductImage loads an item's logo defined in the items register into a picture object on printout.
Header
procedure dlLoadProductImage(Picture: TfrxPictureView; cIdent: String);
Example
Put the picture object named Picture1 onto an arbitrary printout and write the event OnBeforePrint:
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
dlLoadProductImage(Picture1, <qReportIzpis."acIdent">);
end;
dlLoadUserSignature
The procedure dlLoadUserSignature loads the user's signature defined in the subjects register into a picture object on printout.
Header
procedure dlLoadUserSignature(Picture: TfrxPictureView; cIdent: String);
Example
To show the current user's signature, put the picture object named Picture1 onto an arbitrary printout and write the event OnBeforePrint:
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
dlLoadUserSignature(Picture1, < dlGetCurrentUserID>);
end;
To show the signature of 1st signatory on invoice printout, put the picture object named Picture1 onto the printout and write the event OnBeforePrint.
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
dlLoadUserSignature(Picture1,<qReportIzpisD."anSigner1">);
end;
dlNumberInWords
The function dlNumberInWords returns number as words.
The first function parameter is a number (monetary value).
The second parameter is currency.
The third parameter is the language in which text should be returned. If the third parameter is empty, returns the result in the language of the program. If the language does not exist, returns empty text.
Header
function dlNumberInWords(nNumber: Currency; cCurrency, cLanguage: String): String;
Example
Result in English regardless of the program language: thousand EUR 00/100:
[dlNumberInWords(1000,'EUR','EN')]
Print the text for payment on invoice issued in the program’s language:
[dlNumberInWords(<qReportIzpisD."anForPay">, <qReportIzpisD."acCurrency">, '')]
Print the text for payment in English regardless of the program language:
[dlNumberInWords(dlTextToFloat(fZaPlacilo.Text), <qReportIzpisD."acCurrency">, 'EN')]
dlQuotedStr
The procedure dlQuotedStr imitates the Delphi function QuotedStr for solving cases where quotation marks (') exist in data text.
Header
procedure dlQuotedStr(Str: String): String;
Example
[SQLExp('select acCode from tHE_SetItemExtItemSubj where acSubject = ' + dlQuotedStr(<qReportIzpis."acSubject">) + ' ')]
dlStringReplace
The function dlStringReplace imitates the Delphi function StringReplace. The difference is that flags are written as strings instead of option elements. If options are not used, empty strings must be used.
flags
rfReplaceAll – change all found strings, otherwise change only the first appearance of text.
rfIgnoreCase – do not distinguish lowercase and uppercase letters.
Header
function dlStringReplace(const S, OldPattern, NewPattern: String; Flags1, Flag2: String): String;
Example
On balance printouts, where activity codes can be written with a point (for example 15.110) or without it (for example15110), the point will be deleted if it exists.
[dlStringReplace(<qReportIzpis2."acActivityCode">,'.','','rfReplaceAll','')]
dlStrToFloatDef
The function dlStrToFloatDef converts text to decimal number. If the conversion fails, returns the second parameter.
Header
function dlStrToFloatDef(S: String; Default: Extended): Extended;
Example
[dlStrToFloatDef(SQLExp('select SUM(anAmount) from tHE_SADCost where acKey = ''' + <qReportIzpis."acKey"> + ''''), 0)]
dlStrToIntDef
The function dlStrToIntDef converts text to integers. If the conversion fails, returns the second parameter.
Header
function dlStrToIntDef(S: String; Default: Integer): Integer;
Example
[dlStrToIntDef(FormatDateTime('d',<qReportIzpis."adDateDue">),0)]
dlTextToFloat
The function dlTextToFloat converts text with thousand separator into a decimal number. If the conversion fails returns 0.
Header
function dlTextToFloat(S: String): Extended;
Example
Print the exact amount without thousand separator on invoices of issuing goods.
[dlTextToFloat(fTrosarina.Text)]
ExtractMonth and Extract Week
The function ExtractMonth returns the month of a specified date in the form of a number.
The function ExtractWeek returns the week of a specified date in the form of number.
Headers
function ExtractMonth(Date: TDate): String;
function ExtractWeek(Date: TDate): String;
Example
Current month and week:
[ExtractMonth(DATE)]
[ExtractWeek(DATE)]
GetFormValue
The function GetFormValue returns the value of the object in the PANTHEON window. Parameter is the object name including the PANTHEON window on which it is placed. If the object doesn’t exist or it is not created, function returns empty string.
Header
function GetFormValue(FormComponentName: String): Variant;
Example
Print the value in the editbox for the item code in stock as of the date of the printout:
[GetFormValue('PrometIzpisTrenZaloga.fIdent')]
SQLExp
The function SQLExp returns the SQL statement result executed on the database.
Header
function SQLExp(sql: String): String;
Example
Our company city:
[SQLExp('select dbo.fHE_GetOurCompanyCity()')]
Our company's second name:
[SQLExp('select S.acName2 from tHE_SetSubj S, tPA_SysParam P where S.acSubject = P.acOurCompany')]
GetOurCompany
The function GetOurCompany returns subject ID or name 2 of our company according to setting 'Use name 2 as Subject Name' in the administration panel on tab Settings | Program Parameters | Company | Document Texts.
Header
function GetOurCompany: String;
Example
Name of our company: [GetOurCompany]
GetSubject
The funkcija GetSubject returns ID or name 2 of subject according to setting 'Use name 2 as Subject Name' in the administration panel on tab Settings | Program Parameters | Company | Document Texts.
In the case when when setting is NOT checked, returns value of first parameter.
If setting IS checked the function returns second parameter if it is not empty. If second parameter is empty returns subject's name 2. If second name of subject is in dataset on report we recommand you to use the first option because it is faster.
Header
function GetSubject(cSubject, cName2: String): String;
Examples
[GetSubject(<qSubjIzpis."acSubject">, <qSubjIzpis."acName">)]
[GetSubject(<qSubjIzpis."acSubject">, '']
dlGetSQLString
The function dlGetSQLString returns SQL clause which is only parameter.
Header
function dlGetSQLString(ADataset: TfrxDataset): String;
Examples
The most common usage of the function dlGetSQLString is to display the entire SELECT clause that is specified for the selected dataset when the report is started. The most often we display dataset that belongs to a band named Detail:
begin
ShowMessage(dlGetSQLString(Detail.Dataset));
end.
You can also call dataset by name as it is shown in the following example.
begin
ShowMessage(dlGetSQLString(report.GetDataset('qReportIzpis')));
end.