1

Is there any way to pass a table method instead of fieldid to addLink method of a QueryBuildDataSource object? I have this code:

qbdsLedgerTrans.addLink(
        FieldNum(LedgerTable, AccountNum), // Here i need to pass a conditional value of a LedgerTable method instead of a field
        FieldNum(LedgerTrans, AccountNum)
    );
Artem Antonov
  • 109
  • 1
  • 6

2 Answers2

1

I think no because the query API is tightly bound to tables in SQLServer and tables does not contain any method in SQLServer.

The #addLink will be used to generate query join statement so there must use data present inside the database and method are not in the database but in the aod files.

Depending on what you want to do you can have a method to encapsulate your logic and return the corrected fieldId.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
djtal64
  • 425
  • 4
  • 9
  • The problem of encapsulate a logic is that the value that returns this method is a field that belongs to another table and i obtain an error that says that the combination of a field and related field is not valid. – Artem Antonov Feb 08 '12 at 12:39
  • can you be more precise about you try to do ? – djtal64 Feb 08 '12 at 13:09
0

The first argument to the addLink method must be an field of the prior joined table, in this case LedgerTable. It may be returned by a function, but I doubt it will solve your hidden (unstated) problem.

The second argument to the addLink method must be an field of the current datasource table.

In other scenarios (form delayed joins) you could use the addDynalink method instead.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50