SQL question

Florian Bogeschdorfer fb at memedia.de
Thu Nov 11 20:09:12 CST 2004


> 
> Florian,
> 
> You have forget that you cannot use funcs directly in SQL.
> You need BaseObject method
> 

I tried a method. After some time I figured out what to do.
I used the only example in the docs (V4MD) but the field did not become a
method. I set the method flag and since I did not get a method text, I
changed that too...

    AddField(VAL[#ID], VAL[#KUNDENTable],
"gebmo",#kTypeString,5,"MONTH(geburtsdatum)")
    setFieldFlag(VAL[#ID],
getfieldref(val[#ID],val[#KUNDENTable],"gebmo"),16,TRUE)
    ChangeFieldMethod
val[#id],getfieldref(val[#ID],val[#KUNDENTable],"gebmo"),
"MONTH(geburtsdatum)"  
    if valentinaError()<>0 then
      alert "Datenbankerweiterung konnte nicht initialisiert werden. Bitte
informieren Sie den Support"
    end if
    flush(VAL[#ID])  


Anyway, I have a proper method now.../?

y=getfieldref(val[#id],val[#KUNDENTable],"gebmo")
put getfieldflag(x,"gebmo",16)
-- 1
put GetFieldMethod (val[#id],y)
-- "MONTH(geburtsdatum)"

But it does not work, it is always empty...

x=valselectreturncursor("SELECT ** FROM KUNDENTable")

put valgetcurrentrecord(x)
-- [#mobilnummer: "5352152", #mobilnummer_ai: 0, #inhouse: 0, #allowed: 0,
#newDate: "21.07.2004", #lastDate: "00.00.2000", #lastInhouse: "00.00.2000",
#lastActive: "00.00.2000", #flirtID: "", #smsFlirtIDglobal: "", #anrede:
"Hallo", #vorname: "Thomas", #vorname_ai: 460, #name: "Zimmer", #name_ai:
468, #zusatz: "", #strasse1: "Stapenhorststraße 65a", #strasse1_ai: 1669,
#strasse2: "", #plz: "33615", #plz_ai: 258, #ort: "Bielefeld", #ort_ai: 636,
#land: "Deutschland", #geburtsdatum: "12.07.1970", #KD_PICpath: "",
#mixnick: "", #code: "", #email: "tz at cands.info", #telefon: "0521 173686",
#mobilnetz: "D2", #telefonSMStauglich: 1, #fax: "0521 5215185", #geschlecht:
0, #spNr: "", #bdNr: "", #zusatz1: "", #zusatz2: "", #zusatz3: "", #zusatz4:
"", #zusatz5: "", #zusatz6: "", #zusatz7: "", #mailPreferred: "e-Mail",
#KDstatModul1: 0, #KDstatModul2: 0, #KDstatModul3: 0, #KDstatModul4: 0,
#KDstatModul5: 0, #KDstatModul6: 0, #KD_ID: 1, #KD_BUDlistID: 0,
#KD_KDG_ID1: "", #KD_KDG_ID2: "", #KD_KDG_ID3: "", #KD_KDG_ID4: "",
#KD_mailFlag: 1, #KD_smsFlag: 1, #KD_briefFlag: 1, #KD_faxFlag: 1,
#KD_notiz: "", #KD_BLZ: "", #KD_KTO: "", #KD_BankName: "",
#KD_Einzugsermaechtigung: 0, #KD_KTOinhaber: "", #KD_CC_Inhaber: "",
#KD_CC_Nummer: "", #KD_CC_Valid_From: "", #KD_CC_Valid_To: "",
#KD_CC_CardCompany: "", #KD_Ausweisnummer: "", #KD_mobileApproved: 0,
#KD_checkedInToday: 0, #KD_spare1: "", #KD_spare2: "", #KD_spare3: "",
#KD_spare4: 0, #KD_GEB_Year: 0, #KD_GEB_Count: 0, #changed: 0, #FROM_SERIAL:
"2990", #FROM_KD_ID: 1, #gebmo: ""]

You may see, that geburtsdatum is not empty, while #gebmo IS empty. Why?

Also:

x=valselectreturncursor("SELECT geburtsdatum,gebmo FROM KUNDENTable WHERE
gebmo=07")
put valgetcurrentrecord(x)
error 362
error 362
error 362
-- 0

Empty record. Where do I make my mistake?

I also tried this with #gebmo beeing kTypeByte and kTypeShort

Best regards, Florian



More information about the Valentina mailing list