Page 1 of 1

Field Origin

Posted: Sun 08 Jul 2007 08:51
by aliemrei
Hi; I am using SDAC 4.xx and when use view field origin see original tablename.fieldname But I need delivered.fieldname

For example :

Code: Select all

SELECT * FROM
 ( SELECT FATURA.ACIKLAMA AS ACIKLAMA, FATGRUP AS OZELKOD, CARI.HESAPID,CARI.UNVANI,FATURA.FATID AS KAYITID,
     FATURA.TARIH, FATURA.TURADI AS TUR, FATURA.FATNO AS ENO,FATURA.DOVIZKODU,FATURA.DURUM,
     FATURA.KDV, FATURA.GTOPLAM AS TOPLAM ,MUHFC,FISNO,FISTARIH
   FROM FATURA
   INNER JOIN CARI ON FATURA.CARIID = CARI.CARIID
   LEFT OUTER JOIN
     (SELECT COUNTER,TARIH AS FISTARIH,FISNO FROM FIS WHERE 1=1 ) AS FIS ON FIS.COUNTER=FATURA.MUHFC
   WHERE TARIH BETWEEN :IT1 AND :ST1
         &faturatur --FATURA.TURADI IN ('ALIŞ','ALIS')
         &durum -- AND FATURA.DURUM=0
     
 ) AS TBL1
ORDER BY TARIH,UNVANI
we are using expressgrid and we wanting when grid filtered, creating a where clouse from field.origin

thanks and best regards.

Posted: Mon 09 Jul 2007 07:33
by Antaeus
Try to fill the Origin property of your dataset fields manually in the AfterOpen event. This may look like this:

Code: Select all

procedure TForm1.MSQueryAfterOpen(DataSet: TDataSet);
var
  i: integer;
begin
  for i := 0 to DataSet.Fields.Count - 1 do
    DataSet.Fields[i].Origin := 'emp_dept.' + DataSet.Fields[i].FieldName;
end;

thanks but

Posted: Mon 09 Jul 2007 16:23
by aliemrei
if use view or delivered in a sql, originname is have not got original tablename prefix. Sorry but my opinion maybe developer must be choose from dataset's property. what show at origin.

Posted: Tue 10 Jul 2007 08:05
by Antaeus
Sorry, but your explanation is not enough clear for me. Please try to describe the problem in more details. If it is possible, send me a complete small sample demonstrating this problem. My e-mail is evgeniyd*crlab.com.

firstly sorry for my bad english.

Posted: Tue 10 Jul 2007 13:04
by aliemrei
I am using fibplus, and there is a propety for field origin.

TFieldOriginRule =(forNoRule,forTableAndFieldName,forClientFieldName,forTableAliasAndFieldName);

developers can be choose what want.

I hope it's enough a explanation.


very thanks.

Posted: Wed 11 Jul 2007 06:41
by Antaeus
Could you give a detailed account of cases in which you use these rules?
Why the current behaviour of SDAC is unsuitable for you?

Posted: Wed 11 Jul 2007 08:49
by aliemrei
ok, i will send a sample code.

Posted: Wed 11 Jul 2007 11:57
by aliemrei
o sorry i can not a sample because i am using expressgrid.

i will try with my bad english :)

now, I am using devexpress. it's ok. and my all forms is inherited. namely There is a standard form (have got a express grid). another form is inherited from this form. when my customers make a filter (on grid), I am sensitiving filtertext and sending to TMSQuery' s where clouse. Because expressgrid's original filter is very slowly. filter must be in sql (for speed). if MSQuery's sql is easy query then, no problem. But if sql query have got delivered or view, field.origin is showing real [tablename].[fieldname] and begining my problem. I hope, you understand me :)

for example:
SELECT NAME, SIRNAME FROM ADRESS
NAMEfield.orgin is ''ADRESS.NAME" (it 's ok no problem)
BUT
SELECT * FROM (
SELECT NAME, SIRNAME FROM ADRESS) TBL
NAMEfield.orgin is ''ADRESS.NAME" (but not be show this because now origin is "TBL.NAME")

i using fibplus (firebird). fibplus have got a property :
TFieldOriginRule =(forNoRule,forTableAndFieldName,forClientFieldName,forTableAliasAndFieldName);

Sets the rule for filling field origin.

property FieldOriginRule: TFieldOriginRule read FFieldOriginRule write FFieldOriginRule default forTableAndFieldName;

Description

Use the FieldOriginRule property to establish the rule for filling field origin. Can have values:

Value FieldOrigin form
forNoRule Do not fill FieldOrigin.
forTableAndFieldName table-name.field-name.
forClientFieldName field-alias.
forTableAliasAndFieldName table-alias.field-name.
thanks and best regards.

Posted: Fri 13 Jul 2007 12:38
by Antaeus
Thank you for information. We received your e-mail. We will investigate possibility to add such option, but it is unlikely that this will happen in the nearest future.

Posted: Sat 14 Jul 2007 06:52
by aliemrei
thanks for all.

last demand.

SELECT * FROM A
LEFT JOIN B ON B.FIELD = A.FIELD

Sql Generator generating RefreshSql ,
"SELECT * FROM A WHERE A.KEYFIELD = :OLD_KEYFIELD"

if posible, RefreshSql must be :
"SELECT * FROM A
LEFT JOIN B ON B.FIELD = A.FIELD
WHERE A.KEYFIELD = :OLD_KEYFIELD" after generate.

I am changing manuel refresh sql.

Best Regards.

Posted: Mon 16 Jul 2007 14:00
by Antaeus
It is unlikely that we will change this behaviour, as it is pretty hard to generate the correct REFRESH (INSERT/UPDATE/DELETE) statement for complicated queries. In such cases you should fill the RefreshSQL property manually, as you have done.