PANTHEON™ Help

 Категории
 PANTHEON Help - Welcome
[Collapse]PANTHEON
 [Collapse]PANTHEON упатства
  [Expand]Guide for PANTHEON
  [Expand]Ръководство за PANTHEON Търговия
  [Expand]Ръководство за PANTHEON Vet
  [Expand]Ръководство за PANTHEON Фермерство
 [Collapse]PANTHEON потребителски ръководства
  [Expand]Ръководство за потребителя за PANTHEON
  [Expand]Ръководство за потребителя за PANTHEON Retail
  [Expand]Ръководство за потребителя за PANTHEON Vet
  [Expand]Ръководство за потребителя за PANTHEON Farming
[Collapse]PANTHEON Web
 [Collapse]PANTHEON Web Guides
  [Expand]Ръководство за PANTHEON Web Light
  [Expand]Ръководство за PANTHEON Уеб Терминал
  [Expand]Ръководство за PANTHEON Web Legal
  [Expand]Архив на стари продукти
 [Collapse]PANTHEON Web User Manuals
  [Expand]Започване на PANTHEON Web
  [Expand]User Manual for PANTHEON Web Light
   Ръководство за потребителя за PANTHEON Web Terminal
  [Expand]Ръководство за потребителя за PANTHEON Web Legal
  [Expand]Архив на стари продукти
[Collapse]PANTHEON Гранула
 [Collapse]Ръководство за PANTHEON Гранули
  [Expand]Гранула за служители
  [Expand]Пътни заповеди Гранула
  [Expand]Гранула за документи и задачи
  [Expand]Гранула Табло
  [Expand]Гранула за B2B поръчки
  [Expand]Гранула за обслужване на клиенти
  [Expand]Инвентаризация на дълготрайни активи
  [Expand]Гранула за складови наличности
 [Collapse]PANTHEON Granules
   Започване
   Using PANTHEON Granules at Tecta, a fictional company
  [Expand]PANTHEON Granules and activation
  [Expand]PANTHEON Granule Work records
  [Expand]PANTHEON Granule Travel orders
  [Expand]PANTHEON Granule Documents and Tasks
  [Expand]PANTHEON Granule B2B orders
  [Expand]PANTHEON Granule Dashboard
  [Expand]Полеви сервизен гранул
   PANTHEON Granules - FAQ
  [Expand]Инвентаризация на дълготрайни активи
  [Expand]Инвентаризация на склада Гранула
   Архив
[Expand]Потребителски сайт

Load Time: 312,5049 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;

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

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.

You are collecting sales order 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 text object on report. Click on the object to open the text editor. Write expression in the editor.

 

Report of the customer's address from the sales order

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

Comment:

acConsignee

is a field from dataset qReportIzpis which is used to generate a report.

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

'select acAddress from tHE_SetSubj acName = 'Customer & Co.''

and thus the query that is executed is:

select acAddress from tHE_SetSubj acName = 'Customer & Co.'.

Report of the customer's place from the sales order

[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 issue:

Let's look at an example where the collective invoice (receipt or issue) ahs 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 for reports (see Using SQLEXP Statements in Reports). 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 4 (see Linking Documents).

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

1. Create a new record from the report of an already existing report for an invoice. Add a new text object and write into it the 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) hass 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 for reports (see Using SQLEXP Statements in Reports). 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 (see Linking Documents).

Reports of this kind are used to report serial numbers in a consignment report.

1. Create a new record from the report of an already existing report for an invoice. Add a new text object and write into it the 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 in Link type which is V instead of 4.

 

 

  

     


Оценете темата
Темата беше ли ви полезна?
Коментар
Вашият коментар ще бъде видим и във форума!