51

(9 replies, posted in General)

derek wrote:

Hi Josh,
I guess you'll get anomalies no matter which language you're using.
Personally, I just let the 'towords' function do the heavy lifting and then alter the odd instances that are incorrect using 'replacestr' in a bit of script.
And use much the same approach if, after having used 'towords', you need tot translate into a different language.
Regards,
Derek.

These are great.  I always like reviewing your examples.  Thanks from me too.

k245 wrote:

so far my best tool is MVDB.

Thanks for this comment cool


Also to v_pozidis for asking this question, because I have often wondered how others do this too.

53

(9 replies, posted in General)

Hi folks,

I would like to add two cents here about the spelling...

brian.zaballa wrote:

Something I found on that function ToWords is the fourty which has to be forty.

I'm guessing the reason it "has to be" forty is because- fourty is technically not an English word, thus it's not in the English dictionary.


It happens to be one of those English words at play.  There are many exception words like this in English that seem to break any rules, which makes it nearly impossible for nonnative English speakers.  But, that's another topic neutral


I have no idea how this works for French though.

-Josh

54

(12 replies, posted in General)

Sorry if this is off-topic a little, but I'm curious...

softjom wrote:

I will probably switch to MyVisualdataBase

If you don't mind sharing, what will you be switching from?

Hi sparrow,

I haven't been able to experiment with it yet, but it looks like that covers both of my questions.

Thank you for sharing that site.

Hello again,

I have a few other related questions to add for this thread...


1. Is it possible to disable the close button on the MessageDlg() window?  And if not, is it possible to set which button to used as the default (for when the dialog is closed in this way)?


For example:

I noticed that MVD has a confirmation dialog whenever you Clear a file from an DBFile component.  And it will not allow the user to close that dialog without clicking one of the buttons.

Using the MessageDlg(), the user can still close the dialog without clicking one of the buttons which disrupts the script that was provided as a solution in this thread.

If it's not possible to disable the close button, is there a way to set or capture a default action when the dialog is closed?  Anyone have any ideas for how to handle this?


2. Does anyone know of a DialogType parameter for the MessageDlg() to show the question mark similar to the one used in the MVD dialog mentioned above?

The only list mentioned in this thread that I was able to find was from back in 2015.  Is there one available now?

According to the Delphi Basics reference, the mtConfirmation "Displays an question mark".  But, this isn't the case for MVD.  Does anyone know of one for this?

---

I have a screenshot to illustrate my questions...

Thank you for any feedback!

Hi agusecc,

Is that file better than the one that comes with MVD?  Are there any differences, improvements, etc.?

Thanks

Hi derek,
.
I'm starting to get the idea, and I appreciate the extra explanation.  I've seen that structure used in threads about customizing menus, but it was all new to me.  I wanted to ask about it here since this was a little more simple use.
.
Thank you both again.

Brilliant!
.
Precisely what I was after... even though I don't fully understand it.  I'm guessing that's just the syntax for calling a custom function/procedure.
.
Many thanks!

Also sparrow... since you contributed the first solution in that thread I referenced, would you mind further explaining or giving me somewhere else to look so I can learn what you're doing in that statement:
.

Form1.OnClose := @frm1oncl;

.
What is the @ symbol doing there?  This is over my head, and I'm curious to learn it.
.
On first glance, it seems like it may be creating an instance of the function or something..?

Hi sparrow,
.
Okay, that's another option I didn't think of... haha!
.
Thank you for contributing my friend.

Hi Folks!
.
I could use some help here, and I hope the topic is self-explanitory.
.
I'm not able to troubleshoot this because I don't fully understand what's going on in this line:
.

Form2.OnClose := @Form2_OnClose;

.
I've attached a sample project for demonstration...
.
There are currently two unsolved issues:
.
1. When the user changes a field, and then reverts the field back to the original content, the confirmation does not show AND the form will not close (or respond) either.
.
2. The confirmation is showing even when the user clicks the save button.
.
Originally I was using the Close button's On_Click event to handle this.  Then I noticed the user could simply click the window's X (close) button without any confirmation.  So then I found this thread that would handle that, but I can't get it working properly.
.
At this point, I'm almost ready to just settle with the first approach.  I would appreciate any advice and/or suggestions.

63

(7 replies, posted in General)

Merry Christmas to all as well!  Nice pictures cool

Hi Delta,
.
Nice observations.  I'm curious as to where you got the values for the anchors.  Did you find them documented somewhere, or did you manually seek them out?
.
I particularly like your column sizing technique too.


-joshuA

65

(7 replies, posted in General)

Hi all,

Thanks for sharing that example derek.  I hadn't thought of doing it that way.  I have a few forms with labels for general information, and it can be a pain doing this using labels.  I'm going to switch them to RTF now big_smile


-joshuA

66

(7 replies, posted in General)

Hi papafrankc,
.
When you speak of help files- the letters CFM comes to my mind.  I know this is outside of MVD, but it could be an option until the others mention something else...
.
I have not gotten this far with any of my projects to need help files (yet), but this is where I would start.
.
Here is a free version of the tool that creates the files, but you would need to learn how to use it.  I installed it and briefly looked around- it seems straight forward.  I'm sure there would be a way to link to it from within MVD.
.
Good luck,
-joshuA


P.S.
I meant CHM, and not CFM... not sure where that came from lol  too many acronyms floating around in my head
.
And yes, jean.brezhonek's 8th post in here is an updated link to the one above.

67

(4 replies, posted in General)

So, I'm just curious...
.
When Role-based access is enabled, there exists a table named _user.
.
Would it be bad practice to add these "config" related fields to the _user table since they're specific to each user?
.
This may be a question of preference, so if it is... I'm not trying to start an argument over it.  But I am interested in anyone's opinions.
.
-joshuA

68

(4 replies, posted in General)

Hi k245, sparrow,
.
I appreciate both of your comments.
.
Without changing my search functions already in place, I'm going to try the config table approach (for now).  Others have suggested similar per-user "persistent settings" like this, so I think this will serve for other features down the road too.  I have been putting this idea off up until now, so I guess it's time to explore it a bit.
.
I plan to include another example once I get it working smile
.
Again, thank you both
-joshuA

Hello again folks,
.
Is it possible to reference a form's date field in a cfField formula?
.
Currently cfVacEarned is:

ifnull(employee.dateHireMod,0) + 
case when round((julianday('now') - julianday(employee.dateHire))/(365/12)) > 180 then '20'
when round((julianday('now') - julianday(employee.dateHire))/(365/12))> 120 then '15'
when round((julianday('now') - julianday(employee.dateHire))/(365/12))> 60 then '10'
when round((julianday('now') - julianday(employee.dateHire))/(365/12))> 12 then '5'
else '0'
end

This is always referencing today's date.
.
I'm trying to allow users specify a date (mainly for reporting) via the new Date Point field.  Something like this:

ifnull(employee.dateHireMod,0) + 
case when round(({frmMain.dtpDatePoint.SqlDate} - julianday(employee.dateHire))/(365/12)) > 180 then '20'
when round(({frmMain.dtpDatePoint.SqlDate} - julianday(employee.dateHire))/(365/12))> 120 then '15'
when round(({frmMain.dtpDatePoint.SqlDate} - julianday(employee.dateHire))/(365/12))> 60 then '10'
when round(({frmMain.dtpDatePoint.SqlDate} - julianday(employee.dateHire))/(365/12))> 12 then '5'
else '0'
end

This doesn't work, but is there a way to do this?  Or could someone offer ideas on how to accomplish it?
.
Thank you in advance,
-joshuA

70

(5 replies, posted in General)

Hi v_pozids,
My apologies for misinterpreting your question...
When you mention

example for inventory

this automatically makes me thinkg of stocking items.  Usually invoicing is included with this because that's what makes the inventory... "balance out".
Anyways, I will step out of the way for others to contribute.  Good luck with it!
-joshuA

71

(5 replies, posted in General)

Hi v_pozidis,
These may give you some ideas and maybe even a starting point.  You would still need to add the export features that you describe.

ehwagner posted an inventory example from this thread.

There is also an inventory example listed from the main MVD Database examples page.

-joshuA

I love MVD and all the active forum members.  I appreciate all of your help!
.
This is here for reference to anyone else that may benefit from following this (haphazardly named) thread.  I also included a screenshot to show the steps that demonstrate the last few posts.
.
However, I am sure that I will have additional questions to follow lol
.
Thanks again everyone.

Hi agileca23,
.
I was introduced to draw.io this year.  It's a very handy open source tool.  Much- much better than the MS alternative, might I add lol
.
Post your progress with this design while using MVD.  We will look forward to that.

Hi sparrow,
.
Your example has removed my mental block and for that I thank you!
.
I plan to post an updated sample once I get it working.  I just about kicked the idea on duplicate checking for this, but you have given me more ideas big_smile
.
:salute:
.
P.S.
I did have a question in your code...  What are the triple single quotes doing in this line?

WHERE id_employee = '''+frmmain.tablegrid1.Cells[0,i]+'''

Hi sparrow,
.
Thanks for responding.  Sorry for not being more specific in my last post.
.
There are two cases for creating attendance records:
1. A single employee with one or multiple dates
2. A group of employees with a single date (filtered by Department)
.
Everything is working fine so far.  But I'm attempting to check for duplicates prior to creating any records when it applies to multiple employees.
.
This is declaration and field checking portion:

procedure frmAtt_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
    i, j : integer;
    isDuplicate : boolean;
begin                                                     
    // Check that the attendance code has been selected
    if frmAtt.ComboBox1.Text = '' then
    begin
        ShowHint(frmAtt.ComboBox1,'This field is required. Please enter a value for the field.');
        Exit;
    end;

Looping through each employee that has been filtered (in the tableGrid)

    
    for i := 0 to frmmain.tablegrid1.rowcount -1 do
    begin
        isDuplicate := False;

       
Now I'm attempting to check all attendance records for each employee's for duplicate fields

        for j := 0 to SQLExecute('SELECT count(*) FROM attendance WHERE id_employee = '+inttostr(frmmain.tablegrid1.dbindextoid(i))) do
        begin

       
This is where I get lost because I'm not sure how to construct a query that will pull out the pieces for each attendance record.  Because any query that I can come up with returns all the results at once.  I don't know how to control this.  And the ID's don't match the loop counter either, so it's hard to specify which record to use for testing.  And I don't know how to control the flow from SQL.

            
            // This doesn't work, but it's an example of the pieces that I need to test against on the entry form.

            //if (SQLExecute('SELECT aDate, id_attCode FROM attendance WHERE id_employee = '+inttostr(frmmain.tablegrid1.dbindextoid(i))) = frmAtt.dtpDate.sqlDate) then

            // How to check for duplicates on frmAtt.dtpDate, frmAtt.tbAttCode
            // IF THEY EXIST, SIMPLY SKIP THEM...
            // isDuplicate := True;

        end;

After testing for duplicates, then insert the new fields ONLY if none of them were duplicated

        if not isDuplicate then
           //SQLExecute('INSERT INTO attendance (aDate, aTime, aTime2, attNote, id_attCode, id_employee) VALUES('+frmAtt.dtpDate.sqlDate+', '+frmAtt.dtpTime.sqlTime+', '+frmAtt.dtpTime2.sqlTime+', "'+frmAtt.Memo1.Text+'", "'+frmAtt.tbAttCode.Text+'", "'+inttostr(frmmain.tablegrid1.dbindextoid(i))+'")');
    end;
    frmAtt.Close;
    frmEmp.TableGrid1.dbUpdate;
end;

.
I've created a loop inside a loop to filter (and test) each attendance record for each employee in the group (tableGrid list).  At least that's the idea.  It might not be the ideal way for doing this in MVD.  So this is where I'm getting stuck.
.
This is a bit fragmented, but it's hard to highlight code sections unless I just rely on comments.
.
Many thanks!