PANTHEON™ navodila

 Kazalo
 Glavna stran - Dobrodošli v PANTHEON navodila
[Collapse]PANTHEON
 [Collapse]Vodiči za PANTHEON
  [Expand]Vodič po PANTHEON-u
  [Expand]Vodič po PANTHEON Farming
  [Expand]Vodič po PANTHEON Retail
  [Expand]Vodič po PANTHEON Vet
 [Collapse]Uporabniški priročniki za PANTHEON
  [Expand]Uporabniški priročnik za PANTHEON
  [Expand]Uporabniški priročnik za PANTHEON Retail
  [Expand]Uporabniški priročnik za PANTHEON Vet
[Collapse]PANTHEON Web
 [Collapse]Vodiči za PANTHEON Web
  [Expand]Vodič po PANTHEON Web Light
  [Expand]Vodič za PANTHEON Web Terminal
  [Expand]Vodič za PANTHEON Web Legal
  [Expand]Arhiv starih izdelkov
 [Collapse]Uporabniški priročniki za PANTHEON Web
  [Expand]Kako začeti
  [Expand]Uporabniški priročnik za PANTHEON Web Light
   Uporabniški priročnik za PANTHEON Web Terminal
  [Expand]Arhiv starih izdelkov
  [Expand]Uporabniški priročnik za PANTHEON Web Legal
[Collapse]PANTHEON Granule
 [Collapse]Vodiči za PANTHEON Granule
  [Expand]Granula Kadri
  [Expand]Granula Potni nalogi
  [Expand]Granula Dokumenti in Opravila
  [Expand]Granula Nadzorna plošča
  [Expand]Granula B2B Naročanje
  [Expand]Granula Servis na terenu
  [Expand]Inventar fiksnih sredstev
  [Expand]Granula Inventura skladišča
 [Collapse]Uporabniški priročniki za PANTHEON Granule
   Začetek
   Primer uporabe PANTHEON Granul v namišljenem podjetju
  [Expand]PANTHEON Granule in aktivacija
  [Expand]Granula Kadri
  [Expand]Granula Potni nalogi
  [Expand]Granula Dokumenti in opravila
  [Expand]Granula B2B naročanje
  [Expand]Granula Nadzorna plošča
  [Expand]Granula Servis na terenu
  [Expand]Granula Inventura osnovnih sredstev
  [Expand]Granula Inventura skladišča
   PANTHEON Granule - pogosta vprašanja in odgovori
   Arhiv
[Expand]Uporabniške strani

Load Time: 1875,0218 ms
"
  6613 | 1 | |
Label


Examples of Using Pantheon Functions

  An example of using a function dlStringReplace



On the 10A report (Goods | Invoices Issued Reports menu) add a band with the name Detail, serial numbers display that belong to the selected position and the selected invoice. The SQLExp function returns all records, each in its own row, but we want to display serial numbers in one row, separated by commas.
 
[dlStringReplace(SQLExp('SELECT acSerialNo, FROM tHE_MoveItemSerialNo WHERE acKey = ''' + <qReportIzpis."acKey"> + ''' AND acIdent = ''' + <qReportIzpis."acIdent"> + '''  GROUP BY acSerialNo UNION ALL SELECT acSerialNo FROM tHE_OrderItemSerialNo WHERE acKey = ''' + <qReportIzpis."acKey"> + ''' AND acIdent = ''' + <qReportIzpis."acIdent"> + ''' GROUP BY acSerialNo ORDER BY acSerialNo'), #13#10, ', ', 'rfReplaceAll', '')]
 

This chapter presents examples of using aggregate functions, an example of using GetFormValue, SQLEXP, and IIF. Examples of using functions specifically written for PANTHEON and not included in the standard FastReport are explained separately in the Datalab Functions category.

 


A few more complex examples are on the 04C report, which is in the program in the menu Goods | SAD/Intrastat/Excise | Create SAD - Import and on the 3AR report of the Employee Files. In the program, we get to it by navigating to the Employee Files in the Personnel menu, click on the Prints button.

 

An example of using SQLExp function - date fields


On the copy of the 241 that is in the program in the Goods | Issue | Document (eg. 3000 - Sale) add the balance of the issue invoice recipient to the 2200 account on the day of the invoice. It is important that the date is formatted in the form yyyymmdd.

[SQLExp('SELECT SUM(anValDebit-anValCredit) from tHE_AcctTransItem where acAcct = 2200 and acSubject=''' + <qReportIzpisD."acReceiver"> + ''' and adDateDoc <= ''' + FormatDateTime('yyyymmdd',<qReportIzpisD."adDateInv">) + '''')]

 

An example of using SQLExp function - numbers


In this case, we want to use report 156 that is in the program menu Goods | Material Movements that shows the quantity in the alternative measurement unit (EM2).

Since we do not have a factor for the conversion of the quantity in the primary measurement unit (EM) into EM2, it must be obtained from the Units of Measurement register using the SQLExp function.

We do this with the following expression:

[SQLExp('SELECT anUMToUM2 from tHE_SetItem where acIdent = '''+ <qReportIzpis."acIdent">+'''')]

The above expression returns the number as text. Now we want to print the quantity printed in EM2, so we have to convert the value obtained with the dlStrToFloatDef function into a number. Then we divide the amount into the EM with the factor obtained, and using the dlDiv function instead of dividing it from the zero, rather than the ordinary division. Finally, we get:


[dlDiv(<qReportIzpis."anBegState">, dlStrToFloatDef(SQLExp('SELECT anUMToUM2 from tHE_SetItem where acIdent = '''+ <qReportIzpis."acIdent"> +''''), 1))]
 

An example of using SQLExp function - reading data from a window in the program


The following example can be done on a copy of the 16B report, which is in the program menu Goods | Invoices Issued Reports | Invoices Issued/Profit Margin Report. If a warehouse is selected in the window, the expression displays the entire stock of the item, otherwise it only prints the stock in the selected warehouse.

The window in the program from which the report starts is called PrometObracunIzdRac, the input field in which we select the warehouse and has the name fSkladisce. The term that returns the text in this object is already known:


[GetFormValue('PrometObracunIzdRac.fSkladisce')]

First we check if warehouse is selected. If not, the first SQLExp expression that returns the entire stock of the selected item in all the warehouses, otherwise the second one returns the stock of the item only in the selected warehouse.

[IIF (GetFormValue('PrometObracunIzdRac.fSkladisce') = '',
SQLExp('select SUM (anStock) from tHE_Stock where acIdent = ''' +
<qReportIzpis."acIdent"> + ''''),
SQLExp('select anStock from tHE_Stock where acIdent = ''' +
<qReportIzpis."acIdent"> + ''' and acWarehouse = ''' +
GetFormValue('PrometObracunIzdRac.fSkladisce') + ''''))]

 

An example of using SQLExp function with complex select statement

 

A special treatment deserves the expression on the 3AR report that displays whether the worker is disabled or not.

This information is not directly written in the database, but it contains the disability category in the acDisabilityCode field in the table tHR_PrsnHealth. Since the disability category of an individual worker can change, we must get the one that was last entered. The date of the change of disability is recorded in the adCreationDate field in the same table. The following term gives you the last date when the invalidity category for the selected worker has changed.


[SQLExp('select max(adCreatonDate) from tHR_PrsnHealth where acWorker = ''' + <qryDelavec."acWorker"> + '''')]

Then, with the term below, we get the category of disabillity of the worker

[SQLExp('select acDisabilityCode from tHR_PrsnHealth where acWorker = ''' + <qryDelavec."acWorker"> + ''' and adCreatonDate = (select max(adCreatonDate) from tHR_PrsnHealth where acWorker = ''' + <qryDelavec."acWorker"> + ''')')]
 

If in the above term we replace the acDisabilityCode field with 'YES', the expression returns 'Yes' if the worker is disabled, otherwise it returns an empty string. Since, in the case when a worker is not disabled, the expression returns 'NO', we give the term to conditional sentence IIF and finally get

[IIF(SQLExp('select ''DA'' from tHR_PrsnHealth where acWorker = ''' + <qryDelavec."acWorker"> + ''' and adCreatonDate = (select max(adCreatonDate) from tHR_PrsnHealth where acWorker = ''' + <qryDelavec."acWorker"> + ''' and acDisabilityCode > ''0'')') = 'DA','DA','NE')]

 

Example of using SQLExp function - grouping by field that is not in the dataset


It is very unusual and useful to use the SQLExp function for sorting and grouping by field that is not in the dataset.

As a basis, we will take a report 164 that is in the program menu Goods | Invoices Issued Reports | Invoices Issued/Profit Margin Report. First, we create a copy on which we will operate. The data will be grouped by the account issuer and sorted by the issuer and the account number.

The property of the GroupHeader condition is set to the value


SQLExp('select G.acIssuer from tHE_Move G where G.acKey = ''' + <qReportIzpis."acKey"> + ''''),

We replace the inscription which describes the information that we group, and for the data itself, we enter the same as above, but let's put it all together in square brackets (as shown in the figure). To sort in the Reports register, write:

(select G.acIssuer from tHE_Move G where G.acKey = P.acKey), G.acKey



  

  

     


Ali so bila ta navodila uporabna?
Vaše povratne informacije bodo prispevale k boljši pomoči.
Komentarji
Komentarji so izpostavljeni tudi na forumu.