procedure frm_importdata_Button_ValidateData_OnClick (Sender: TObject; var Cancel: boolean);
var
i,l: integer;
province: Array[0..l] of String;
begin
frm_importdata.Button_SelectFile.Enabled := False;
frm_importdata.Button_UploadData.Enabled := False;
frm_importdata.Edit_FilePath.Enabled := False;
frm_importdata.TableGrid_DataUploaded.Enabled := False;
frm_importdata.Button_Delete.Enabled := False;
frm_importdata.Button_ValidateData.Enabled := False;
frm_importdata.Label_Task.Caption := '.::VALIDATING DATA TO IMPORT::.';
If VarToStr(SQLExecute('Select count(imp.province) From import_data imp Where imp.province not in (Select denomination from province)')) <> '0' Then
Begin
MessageDlg('There are names of provinces that are not in the Database.', mtError, mbOk, 0);
frm_importdata.Memo_Logs.Lines.Add('- Provinces: ERROR, There are names of provinces that are not in the Database.');
l := StrToInt(VarToStr(SQLExecute('Select count(imp.province) From import_data imp Where imp.province not in (Select denomination from province)')));
province := [VarToStr(SQLExecute('Select imp.province From import_data imp Where imp.province not in (Select denomination from province)'))];
For i := 0 to (length(province)-1) do
Begin
frm_importdata.Memo_Logs.Lines.Add('Error: ' + province[i]);
End;
End Else frm_importdata.Memo_Logs.Lines.Add('- Provinces: OK ');
frm_importdata.Button_SelectFile.Enabled := True;
frm_importdata.Button_UploadData.Enabled := True;
frm_importdata.Edit_FilePath.Enabled := True;
frm_importdata.TableGrid_DataUploaded.Enabled := True;
frm_importdata.Button_Delete.Enabled := True;
frm_importdata.Button_ValidateData.Enabled := True;
end;
Supposedly in this part I define the values of the array. That query returns 2 results.
province := [VarToStr(SQLExecute('Select imp.province From import_data imp Where imp.province not in (Select denomination from province)'))];
But when I try to print the values it only prints one instead of two.
For i := 0 to (length(province)-1) do
Begin
frm_importdata.Memo_Logs.Lines.Add('Error: ' + province[i]);
End;
How could I solve this. I've been researching and could work with records, that's why I asked above, but I have problems declaring a record, I don't know where it goes in the structure, or how it is declared. I tried some ways that I found on the internet but it gives me syntax error.
Internet example:
procedure TForm1.Button1Click(Sender: TObject);
type
registroPrueba = record
campo1 : integer;
campo2 : string;
campo3 : double;
campo4 : TStringList;
end;
var
registro : registroPrueba;
listaEjemplo : TStringList;
begin
registro.campo1 := 43;
registro.campo2 := 'This is a record test';
registro.campo3 := 112234;
//we initialize any TStringList and insert values to it
listaEjemplo := TStringList.Create;
listaEjemplo.Add('This is a test');
listaEjemplo.Add('inserting a list');
listaEjemplo.Add('in a type "record"');
//we initialize the TStringList of the registry
registro.campo4 := TStringList.Create;
//we insert the previously created list in the registry
registro.campo4 := listaEjemplo;
//we show some value from the registry
showmessage (registro.campo4.Strings[1]);
showmessage (IntToStr(registro.campo1));
end;