PANTHEON™ Help

 Toc
 Početna stranica - PANTHEON uputstva
[Collapse]PANTHEON
 [Collapse]PANTHEON priručnici
  [Expand]Vodič po Datalab PANTHEON FarmAccounting
  [Expand]Vodič po PANTHEON Retail
  [Expand]Vodič po DataLab PANTHEON™
  [Expand]Vodič po PANTHEON VET
 [Collapse]PANTHEON korisnički priručnici
  [Expand]Korisnički priručnik za DataLab PANTHEON
  [Expand]Korisnički priručnik za PANTHEON Vet
  [Expand]Korisnički priručnik za PANTHEON Maloprodaju
  [Expand]Korisnički priručnik za PANTHEON Farming
[Collapse]PANTHEON Web
 [Collapse]Vodiči po PANTHEON Web
  [Expand]Vodič za PANTHEON Web Terminal
  [Expand]Vodič po PANTHEON Web Light
  [Expand]Vodič za PANTHEON Web Legal
  [Expand]Arhiva starih proizvoda
 [Collapse]Korisnički priručniki za PANTHEON Web
  [Expand]Kako započeti s programom PANTHEON Web
  [Expand]Korisnički priručnik za PANTHEON Web Light
   Korisnički priručnik za PANTHEON Web Terminal
  [Expand]Korisnički priručnik za PANTHEON Web Legal
  [Expand]Arhiva starih proizvoda
[Collapse]PANTHEON Granule
 [Collapse]Vodič za PANTHEON Granule
  [Expand]Granula Kadrovi
  [Expand]Granula Putni nalozi
  [Expand]Granula Dokumenti i zadaci
  [Expand]Granula Nadzorna ploča
  [Expand]Granula B2B naručivanje
  [Expand]Granula Servis na terenu
  [Expand]Inventar Fiksne Imovine Granula
  [Expand]Granula Inventura skladišta
 [Collapse]Korisnički priručnik za PANTHEON Granule
   Početak
   Primjer korištenja PANTHEON Granula u fiktivnom preduzeću
  [Expand]PANTHEON Granule i aktivacija
  [Expand]Granula Kadrovi
  [Expand]Granula Putni nalozi
  [Expand]Granula Dokumenti i zadaci
  [Expand]Granula B2B Naručivanje
  [Expand]Granula Nadzorna ploča
  [Expand]Granula Servis na terenu
   PANTHEON Granule - česta pitanja i odgovori
  [Expand]Inventar Fiksne Imovine Granula
  [Expand]Inventar u skladištu granula
  [Expand]Arhiva
[Collapse]Korisničke stranice
  Test 2
  Test 3
  Test 5
  TEST_Kreiranje noveg zaposlenika 1000003067
  TEST_Kreiranje noveg zaposlenika 1000003067-MK
  TEST3_Kreiranje novog dokumenta 1000003410-SL
  TEST2_Uređivanje kontaktnih podataka 1000003415-SL
  Test
 [Collapse]Test za CG
   Test podređeni 1
  TEST_Kreiranje noveg zaposlenika 1000003067-BA
  TEST_Kreiranje novog zaposlenika 1000003067-SR
  TEST_Kreiranje noveg zaposlenika 1000003067_EU_ORIG
 [Collapse]Pantheon hosting
  [Expand]Hosting robot
  [Expand]DEMO hosting
  Porez ( cookies )
 [Collapse]Prijava na korisničke stranice
   Registracija za Pantheon korisnike
   Glavna stranica
   Prva posjeta korisničkom sajtu
  Novosti
  Uvod u Wiki
  Upute za stranicu izbornika
 [Collapse]Potpora
  [Expand]Tehnička podrška
   Podrška na daljinu za Host korisnike
  [Expand]Daljinska podrška
  Kako upotrebljavam i dopunjujem wiki ?
 [Collapse]Pomoć
   Pantheon Hosting
   Uporedba verzija pantheona
  [Expand]Dokumentacija
   Vsa navodila
   Video uputstva
   Video novosti
   Pitaj druge korisnike
   Postanite PANTHEON svetovalec
   Sve vijesti
   Svi događaji
   Pregled opomb i planova
   Plan
 [Collapse]Informacije
   Obavijesti
  [Expand]Nastavitev deviznih tečajev
 [Collapse]Moji podaci
   Ugovor o osvježavanju
   Podaci o kompaniji
  [Expand]Pooblaščene osobe
   Dovoljenja
   Lični podaci
   Kontaktni podatci
   Osveževalna pogodba
 [Collapse]Forum
   Spremljanje foruma
 [Collapse]Video
   Instruktivni videozapisi
   Video Ažuriranja
  Portal za razvijače
  Tržnica
 [Collapse]Wiki uputstva
  [Expand]Uvod u wiki
  [Expand]Pretraga po Wikiju
  [Expand]Uređenje Wiki-a
   Pripenjanje dokumentov

Load Time: 390,6272 ms
"
  6613 | 1 | |
Label


Function SQLExp

SQLExp is a function that allows you to access data that is otherwise not available in the original dataset of a report.

This way you can include data from other tables into user-defined reports.

Function header

function SQLExp(sql:String): String;

Simple example

Let us first look at two simple examples which can be used on every report. Next expression returns address of subject named 'Factory'

First example returns name of our company

SQLexp('select S.acSubject from tHE_SetSubj S, tPA_SysParam P where S.acSubject = P.acOurCompany')


SQLexp('select S.acSubject from tHE_SetSubj S, tPA_SysParam P where S.acSubject = P.acOurCompany')

select S.acSubject from tHE_SetSubj S, tPA_SysParam P where S.acSubject = P.acOurCompany')

 

SQLexp('select acAddress from tHE_SetSubj where acSubject = ''Factory''')

Example of the Use on the Report 103 - Order report - detailed

You are collecting sales orders and once a week you deliver these orders to consignees. In the sales order report you can create a report of non-dispatched orders with entered Delivery field (delivery method) Delivery - with own truck.

In the dataset of sales order report are not provided the customer's address and post. All these data are available in the Subjects register, as for the Subjects ID, it is already present in the dataset of the 103 - Order report - detailed report.

All criteria were met to use the SQLExp on the report. Let's look!

Put the text object on report. Click on the object to open the text editor. Write expression in the editor. You must enclose expression between square brackets. because it is written as expression in text object.

[SQLExp('select acAddress from tHE_SetSubj where acSubject  = ' + dlQuotedStr(<qReportIzpis."acConsignee">) + '')]

Explanation

acConsignee is the field in thedataset qReportIzpis which is used to generate a report.

Function dlQuotedStr (registered for report by Datalab) converts string to quoted version.

After replacing dlQuotedStr(<qReportIzpis."acConsignee">) , the SQL command is:

'select acAddress from tHE_SetSubj where acSubject  = '''Customer&Co.''' '

and thus the query that is executed is:

select acAdrdess from tHE_SetSubj where acSubject  = 'Customer&Co.''

000001.gif Because the names of datasets and fields could differ in each report, you must check the name of the dataset and fields for each concrete report.
 

Report of the customer's place from the sales order

SQL sentence is in this case join of two tables

[SQLExp('select P.acName from tHE_SetSubj S left join tHE_SetPostCode P on S.acPost = P.acPost where acSubject  = ' + dlQuotedStr(<qReportIzpis."acConsignee">) + '')]

Example of a collective invoice

Let's look at an example where the collective invoice (receipt or issue) has been created from internal documents (receipts or issues) in which you've received or issued goods tracked by serial numbers.

The report of a collective invoice or an overview of serial numbers will not produce information about the received or issued serial numbers of items from the collective invoice, because these serial numbers were received or issued through internal documents.

But you can report a list of received or issued serial numbers! To do this, use the SQLExp function.  Serial numbers will be directly reported using the link table, where type of link between the internal document and the collective invoice is 4.

Reports of this kind are used to report serial numbers in a collective invoice that has been created directly from internal documents.

Create a new copy from the report of an already existing report for an invoice. Add a new text object and write the following SQL sentence:

[SQLExp('select S.acSerialNo + '' ('' + LTrim(Str(Sum(S.anQty), 10, 2)) + '')'' as SN from tHE_MoveItemSerialNo S, tHE_LinkMoveItemMoveItem V where V.acLnkKey = S.acKey and V.anLnkNo = S.anNo and V.acType = ''4'' and V.acKey = ''' + <tbIzpisPrometPoz."acKey"> + ''' and V.anNo = ' + VarToStr(<tbIzpisPrometPoz."anNo">) + ' group by S.acSerialNo')]

An Example of a Collective Document Created with Internal Documents

Let's look at an example where the collective invoice (receipt or issue) has been created from internal issue documents in which you've issued consignment goods tracked by serial numbers.

The report of a collective invoice or an overview of serial numbers will not produce information about the issued serial numbers of items from the collective invoice, because these serial numbers were issued through an issue document for the customer.

But you can report a list of issued serial numbers! To do this, use the SQLExp function. Serial numbers will be directly reported using the link table, where the link between the internal document and the collective invoice is entered with type V.

1. Create a new copy from the report of an already existing report for an invoice. Add a new text object and write the following SQL sentence:

[SQLExp('select S.acSerialNo + '' ('' + LTrim(Str(Sum(S.anQty), 10, 2)) + '')'' as SN from tHE_MoveItemSerialNo S, tHE_LinkMoveItemMoveItem V where V.acLnkKey = S.acKey and V.anLnkNo = S.anNo and V.acType = ''V'' and V.acKey = ''' + <tbIzpisPrometPoz."acKey"> + ''' and V.anNo = ' + VarToStr(<tbIzpisPrometPoz."anNo">) + ' group by S.acSerialNo')]

A difference from the previous example is only that link type is in this case V instead of 4.

An Example of Calling the Stored Procedure from SQLExp Function

Function parameter can alsoParameterargument of function SQLExp an also be a stored procedure

Next example returns place of our company using stored procedure  fHE_GetOurCompanyCity

SQLExp('select dbo.fHE_GetOurCompanyCity()

 

 

 

  

     


Rate this topic
Was this topic usefull?
Comments
Comment will also bo visible in forum!