1

(2 replies, posted in General)

I think all you need is the opposite function to the one you used to encode the database.

It would only work for your database though .

I've never been able to get the MVD DecryptRC5 to work for me though, it always crashes the program.

2

(8 replies, posted in Russian)

Here is a link to a fastscript forum concerning the use of TfsXMLDocument, they came to the conclusion it is better to use OLE  Microsoft.XMLDom.

http://forums.blumentals.net/viewtopic. … amp;t=7169

Thread:   http://forums.blumentals.net/viewtopic. … 169#p24988

Generally speaking, you could export the current database in CSV format and then import into the new database. If the new fields are to the right of the old fields (so to speak), you should be able to just import the records so long as the old field names have not been changed.

The Export and Import function provided in MVD under options should do the trick.

4

(8 replies, posted in Russian)

Sounds interesting.

5

(4 replies, posted in General)

Is Tax rate actually being filled? Try changing  Tax from a double to (temporarily) Int or Var putting in a

TaxRate := sqlexecute('select TaxRate from TaxRates where id = '+frmRevenue.cbTaxRate.sqlvalue);
showmessage((InttoStr(taxrate));

or "varToStr


If TaxRate is not getting data assigned your next line will fail as you would be dividing zero by 100 (0/100) which will cause an error.  The declaration of Tax as a double might also be causing a problem in MVD

6

(5 replies, posted in General)

This was the article I was thinking of.

https://createmyvisualdatabaseapp.blogs … -post.html

7

(5 replies, posted in General)

I think you need to have a look at K245 posts in the Russian section, his latest 'tutorial' address that kind of thing using MVD.

Were you thinking of this? I posted parts of this on the forum previously.


Если вы подумали об этом, я ранее публиковал часть этого на форуме.



function CountBackups(dir: string) : string;
var
  fileList : TStringList;
 // count : integer;
begin
   result := '0';
   fileList := TStringList.Create;
   fileList.Text := GetFilesList(dir, '*.db',False);
   result := intToStr(fileList.Count -1);                                                                       

   fileList.Free;

end;
procedure frmMain_OnClose (Sender: TObject; Action: string);
begin
   
     CopyFile('Test.db', 'backup/backup '+ FormatDateTime('dd-mm-yyyy hh-nn-ss', now)+'.db');  
    dbBackup(b);
  
     Timer.Free;
     
end;
procedure OnTimer;
begin

     iSeconds := iSeconds + 1;
     frmMain.lbCounter.Caption := ' '+intToStr(iSeconds);
     AutocloseSet;
     if iSeconds > 30 then // backup every 3.5 hours (14400 seconds)
     begin
         // dbBackup(b);
          dbUpdateTimer;  
          iSeconds := 0;
     end;
end;

procedure dbBackup(d: string);
 var
  z : boolean;
begin

    z := ForceDirectories(d);

    if z then
       CopyFile(dbName, d + '/WOS_backup '+ FormatDateTime('dd-mm-yyyy hh-nn-ss',now)+'.db')
    else
      messageBox('Folder '+d +' does not exist', 'Backup Folder', 0);

   frmMain.lbFileCount.Caption := CountBackups(d);

end;
procedure frmMain_OnShow (Sender: TObject; Action: string);
var
b,y :string;
begin

   b :=  ExtractFilePath(Application.ExeName);
   y :=  b;
   b := b + 'backup\backup ' + dtToday;
   y := y + 'backup\backup ' + dtYesterday;
   //CreateDir(y); // this is required to stop file does not exist message on first open
  { if y < b then
     DeleteDB(y); move this to onClose}

    dbBackup(b);
  
//global code
var
  Timer : TTimer;
  iSeconds : integer;

Do you need to store the calculations in the database or just view them?

If just viewing you will need to write a 'calculated field' entry. This means everytime you view the record the time will be calculated on the spot as you look at the record.

To do this on the database setup page find the table that has the start and finish times and make a new calculated field:


Field Name:   timings

strftime(%s, TABLE_NAME.your_field_finishtime) - strftime(TABLE_NAME.your_field_starttime)

A way papafrankc is for the duplicate test to convert all the text to either uppercase or lowercase.

UpperCase(s:string): string;  or LowerCase(s:string): string;

11

(12 replies, posted in General)

Go to the Russian part of this forum and look for K245 he has just written up on how to turn an image of some kind in to operating like a button.

https://createmyvisualdatabaseapp.blogs … /ui-1.html

The website is in Russian. You will need to either have Google page Translate installed in your browser or cut and paste into Google Translate.

12

(16 replies, posted in General)

haruna wrote:

HELLO CDB

I'm still around.

13

(6 replies, posted in General)

If your modem uses the AT command set, I would think it possible.

There is a large project on here somewhere that sends SMS, I think was called iAPPt

papafrankc,

If you are taking a typed in date from a memo field  and want to make it an actual date from MVD/Pascal point of view you need to use strToDate(Form.Memo.Text) might also be strToDate(Form.Memo.Lines[line number]) or DateToStr if taking a date and placing it into a memo field.

Ах я понимаю спасибо

You will need to do this using Script.

In the AfterClick event of your delete button you will need to run the deletefile function.


//Note not tested.

procedure frmYourFormName_Button1_OnAfterClick (filetext : string);
var FileName : string;
begin
  FileName := filetext;
  if FileExists(FileName) then
  begin
     DeleteFile(FileName);
  end
  else
    MessageBox('File ' + FileName + 'does not exist ','Delete Error ' , MB_OK+MB_ICONERROR);
end;

There are at least a couple of ways on how to pass the filename to the Button event.

First is to have a label or textedit that has its Visible property set to false and write the SQL to populate the label Caption or the Text of an edit text and then pass that to the filetext parameter.

or call the Button_OnClick event and write the delete SQL code there.

It depends on whether you have already written code to delete the entry in the database or if you are letting MVD do it for you behind the scenes.

var
 localImagePath : string;
ImageId:string;
begin
ImageId := intToStr(frmYour_form_name.your_component_name.dbItemID);

localImagePath := SQLExecute(' SELECT your_database_field_name FROM your_table_name WHERE id="'+ImageId+'"');
frmEdit.text := localImagePath;

// The above code needs to be called before you delete the database entry if you are using the inbuilt delete function of MVD. If you are writing the code yourself for the complete delete function, you could combine the above code into the button click event. Unless you want a universal function to call for other file deletions.
end;

I'm very interested in this and I'm trying to follow along.


Is it possible just to post what icon represents what in the side bar? When I'm learning something new, I like my attempts to match those in the instructions. Once I understand what is happening then I experiment.


Does the Asian Hat = user , The filing cabinet = ?  , Secured File = ?, Bookmark =?


I assume the sun = Add, the 'I' = About, Chat = chat and Next month = Next Month.

18

(5 replies, posted in General)

Sample project attached.

Change all the 'fake email addresses ' with real ones in the script.  Of course in a real environment you may use a textbox.text for the email address or a combobox.

19

(5 replies, posted in General)

An example:

The code below tries to open Outlook and fill it with HTML content, if that fails a simple text based email is sent.


procedure frmEmail_btnSendEmail_OnClick (Sender: TObject; var Cancel: boolean);
const
    olMAILITEM = 0;
var
    Outlook: Variant;
    vMailItem: variant;
    indx : integer;
    txt, propName: String;
    sList:TstringList;
begin
         sList:=TStringList.Create;
         sList.Add('<html>');
         sList.Add('<head>');
         sList.add('<style>');
         sList.Add('table, th, td {');
         sList.Add(' border: 1px solid #dddddd; text-align: left; padding: 8px');
         sList.Add('}');
         sList.Add('</style>');
         sList.add('</head>');
         sList.Add('<body>');
         sList.Add('<table>');
         sList.Add('<tr><th>Part Number</th>'+ '<th>BSuite#</th>' + '<th>Description'+ '</th>'+'<th>Qty'+'</th>'+'<th>For'+'</th>'+'</tr>');

         for indx := 0 to frmEmail.tgEmailList.RowCount-1 do
         begin
            sList.Add('<tr><td>'+frmEmail.tgEmailList.Cells[0,indx] + '</td>' + '<td>' +frmEmail.tgEmailList.Cells[1,indx] +'</td>'+'<td>'+frmEmail.tgEmailList.Cells[2,indx]+'</td>'+'<td> x '+frmEmail.tgEmailList.Cells[3,indx]+'</td>'+'<td>'+frmEmail.tgEmailList.Cells[4,indx]+'</td></tr>');
         end;
         sList.Add('</table>');
         sList.Add('</body>');
         sList.Add('</html>');


        if frmEmail.cmbSupplierList.ItemIndex = -1 then
         messagebox('You have not selected an order to email. Please select a supplier', 'EMAILING ERROR',0)
       else
       begin
          frmEmail.tgEmailList.dbPopUPMenu.Items.Find('Copy All').click;
          txt := ClipboardGet;
         try
           propName := 'https://schemas.microsoft.com/mapi/proptag/0x59020003';
           Outlook := CreateOleObject('Outlook.Application');
           vMailItem := Outlook.GetNamespace('MAPI');
           vMailItem.Logon(null,null,true,null);
           vMailItem := Outlook.CreateItem(olMailItem);
           vMailItem.Recipients.Add(frmEmail.cmbEmailAddress.Text);
           vMailItem.Subject := frmEmail.cmbSupplierList.Text;
           vMailItem.HTMLBody := sList.text;
           OutLook.SetProperty(propName, EncodingFlag);
           vMailItem.Send;
           Outlook.free;
         except

           openURL('mailto:'+frmEmail.cmbEmailAddress.Text+'?Subject='+frmEmail.cmbSupplierList.Text+' Order'+'&Body='+sList.text);
         end;
       end;

    frmEmail.tgEmailList.SelectRange(0,frmEmail.tgEmailList.RowCount -1,TRUE);
    for indx := 0 to frmEmail.tgEmailList.RowCount -1 do
    begin

      SQLExecute('UPDATE orders SET orderEmailed = 1 WHERE orders.id = "'+ intToStr(frmEmail.tgEmailList.dbIndexToID(indx))+'"');

    end;
    frmEmail.cmbSupplierList.ItemIndex := -1;
    sList.free;
end;

There is another Russian one, which is quite promising in terms of the form and components, but it has three drawbacks.

1. It only works with Access databases.

2. It is really difficult at the moment to make your own form, altering the existing examples is possible.

3. The developer hasn't upgraded it for a year or so.

Dybase  - lucasproject  www.dybase.ru


Now if Dmitry and Lucasprojects got together, they could develop a super RAd database program.

vit007 wrote:

А нельзя через скрипт, чтоб автоматически открывался браузер по умолчанию.

При нажатии на гиперссылку автоматически открывается браузер по умолчанию.

An example

procedure frmMain_lbWebpage_OnClick (Sender: TObject);
var
    webpage:string;
begin
  
  webpage := frmMain.lbWebpage.Caption; 
  OpenURL(webpage);
end;

Здесь у меня есть метка, которая при двойном щелчке по гиперссылке открывает URL-адрес в браузере по умолчанию.

22

(9 replies, posted in Russian)

Here is another way

form1.DatePicker2.DateTime := form1.DatePicker1.DateTime + EncodeTime(1,0,0,0);

As for the Edit text.  Что касается текстового поля редактирования

form1.Edit1.text := TimeToStr(form1.DatePicker1.DateTime);

23

(3 replies, posted in Talks about all)

Looks very snazzy

24

(1 replies, posted in Russian)

There is a

form1.Canvas.Rectangle(X1,Y1,X2,Y2)

25

(6 replies, posted in General)

Hmm, 2020 was a leap year, if you use 2024 do you get the same problem?