Forum > Databases

[SOLVED] Tdbf FPC components vs Lazarus DataAcess TDbf???

<< < (2/3) > >>

1HuntnMan:
This is what I messed up yesterday that was causing the procedure (CmboBxSelectIndexExit) below to create indexes on the fly...
var
  FrmAppmts: TFrmAppmts;
  keys: TStringList;
 
procedure TFrmAppmts.CmboBxSelectIndexSelect(Sender: TObject);
begin
  case CmboBxSelectIndex.Text of
    'Contact (L,F,M)':DbfAppmts.IndexName:= 'CNTKNAME';
    'Client/Customer':DbfAppmts.IndexName:= 'CLIENT';
    'Appt. Date/Time':DbfAppmts.IndexName:= 'APPTDTIME'
  else
    WriteLn ('Index Unchanged!');
  end;
  JvDBSrchByIndex.DataField:= '';
  DbfAppmts.Refresh;
end;

procedure TFrmAppmts.CmboBxSelectIndexExit(Sender: TObject);
var
  I: Integer;
begin
  keys:= TStringList.Create;
  keys.Delimiter:= ':';
  keys.NameValueSeparator:= '=';
  keys.StrictDelimiter:= True;
  keys.DelimitedText:= 'Contact (L,F.M)=CNTKLNAME:Client/Customer=CLIENT:'+
   'Appt. Date/Time=APPTDATETIME';
  I:= keys.IndexOfName(CmboBxSelectIndex.Text);
  if I <> -1 then JvDBSrchByIndex.DataField:= keys.ValueFromIndex;
  DbfAppmts.Refresh;
end;

What I figured out testing is, I must of been in Dementia mode because in  the CmboBxSelectIndexExit I had assigned the index names instead of the field names. I corrected that this morning but these 2 procedures won't work if you define a primary index and fieldname. Also, I removed searching by the primary index on 3 of the units because they just didn't work properly. After compiling it's like I didn't compile anything. Nothing's changed. So, I think I'm going to wipe out Laz and reinstall everything.  There's more to this story I think! For example after removing the Primary Index from above it's rendering the CNTKNAME, CLIENT and APPTID indexes which isn't even in the code.

After I reinstall Laz, I'll let you know if things are behaving properly.

cdbc:
Hi
Under your project-dir, there's a dir named lib.
Under lib there's another dir ...\win64\ I think...
In there all you project's compiled units' ppu,o,or files reside, try to delete them before you do a new install...
And recompile project of course...
Regards Benny

wp:

--- Quote from: 1HuntnMan on February 12, 2024, 03:50:15 pm ---
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFrmAppmts.CmboBxSelectIndexSelect(Sender: TObject);begin  case CmboBxSelectIndex.Text of    'Contact (L,F,M)':DbfAppmts.IndexName:= 'CNTKNAME';    'Client/Customer':DbfAppmts.IndexName:= 'CLIENT';    'Appt. Date/Time':DbfAppmts.IndexName:= 'APPTDTIME'    [...]  end;[...]end; procedure TFrmAppmts.CmboBxSelectIndexExit(Sender: TObject); begin  [...]  keys.DelimitedText:= 'Contact (L,F.M)=CNTKLNAME:Client/Customer=CLIENT:'+  [...]end; 
--- End quote ---
At first: please put your code into [ code ] tags - this makes it easier for us to read your code, and it avoids that the forum software interprets indices [ i] as instruction to render the following text in italic.

Then: Is this a typo in 'Contact(L,F.M)' (line 16), using a point rather than a comma as in the first occurance (line 4)?

1HuntnMan:
Is this what you mean by putting code in as tags or encapsulated within
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- my code ?


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFrmAppmts.CmboBxSelectIndexSelect(Sender: TObject);begin  case CmboBxSelectIndex.Text of    'Contact (L,F,M)':DbfAppmts.IndexName:= 'CNTKNAME';    'Client/Customer':DbfAppmts.IndexName:= 'CLIENT';    'Appt. Date/Time':DbfAppmts.IndexName:= 'APPTDTIME'  else    WriteLn ('Index Unchanged!');  end;  JvDBSrchByIndex.DataField:= '';  DbfAppmts.Refresh;end; procedure TFrmAppmts.CmboBxSelectIndexExit(Sender: TObject);var  I: Integer;begin  keys:= TStringList.Create;  keys.Delimiter:= ':';  keys.NameValueSeparator:= '=';  keys.StrictDelimiter:= True;  keys.DelimitedText:= 'Contact (L,F.M)=CNTKLNAME:Client/Customer=CLIENT:'+   'Appt. Date/Time=APPTDATETIME';  I:= keys.IndexOfName(CmboBxSelectIndex.Text);  if I <> -1 then JvDBSrchByIndex.DataField:= keys.ValueFromIndex[I];  DbfAppmts.Refresh;end; 
Also, didn't understand...  Is this a typo in 'Contact(L,F.M)' (using a point rather than a comma as in the first occurrence)? What's a point? In the first procedure I'm just defining what the user sees as the index.   'Contact (L,F,M)':DbfAppmts.IndexName:= 'CNTKNAME'; The drop-down shows them sort by Contact (L,F,M) or by Client/Customer, etc. Then, in the JvDBSrchByIndex.DataField component which is the second procedure the user is typing and it's suppose to be context-sensitive search by what's being typed into the component.

I'm going to delete everything under C:\Users\DKing\Documents\Software Development\PMS Project\lib\x86_64-win64 and then recompile and see if that changes something ... Tks

1HuntnMan:
Woops, you're right just saw it, it's a typeo. Should be a comma.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version