OCLOperators sqlpassthroughobjects
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
===Example of using the sqlpassthroughobjects=== | ===Example of using the sqlpassthroughobjects=== | ||
The two examples below can be used in a derived association | The two examples below can be used in a derived association. | ||
=====If you already have the primary key available you can | =====If you already have the primary key available, you can do this:===== | ||
Kundfaktura.sqlpassthroughobjects('select ' + self.FakturaReferensnummer.toString )->first | Kundfaktura.sqlpassthroughobjects('select ' + self.FakturaReferensnummer.toString )->first | ||
=====If looking for a specific object using some field===== | =====If you are looking for a specific object using some field:===== | ||
Kundfaktura.sqlpassthroughobjects('select FAKTURA_ID from tbl_FAKTUROR where FAKTURA_ID = ' + self.FakturaReferensnummer.toString )->first | Kundfaktura.sqlpassthroughobjects('select FAKTURA_ID from tbl_FAKTUROR where FAKTURA_ID = ' + self.FakturaReferensnummer.toString )->first | ||
[[Category:OCLOperators]] | |||
Notes | Notes: | ||
* You can use '''@variable''' in your | * You can use '''@variable''' in your SQL because it is an automatically available variable when the function is called. | ||
* You need to quote strings to be passed (if they aren't variables), like ''self.Anvandarnamn'' above. The \' is an escaped quote in OCL ([[Escape codes]]) | * You need to quote strings to be passed (if they aren't variables), like ''self.Anvandarnamn'' above. The \' is an escaped quote in OCL ([[Escape codes]]). |
Revision as of 07:18, 6 March 2023
Example of using the sqlpassthroughobjects
The two examples below can be used in a derived association.
If you already have the primary key available, you can do this:
Kundfaktura.sqlpassthroughobjects('select ' + self.FakturaReferensnummer.toString )->first
If you are looking for a specific object using some field:
Kundfaktura.sqlpassthroughobjects('select FAKTURA_ID from tbl_FAKTUROR where FAKTURA_ID = ' + self.FakturaReferensnummer.toString )->first
Notes:
- You can use @variable in your SQL because it is an automatically available variable when the function is called.
- You need to quote strings to be passed (if they aren't variables), like self.Anvandarnamn above. The \' is an escaped quote in OCL (Escape codes).
This page was edited more than 11 months ago on 02/10/2024. What links here