2,201

(26 replies, posted in General)

Hi Adam,
I don't imagine there's any reason why the same process I used for the PIR wouldn't work for the SIR (and the only reason I didn't do the SIR was I ran out of time at this end).
I'll try and have a look later on if no one's come back to you in the meantime.
Regards,
Derek.

2,202

(4 replies, posted in General)

Hello Heriberto,

From my own experience, I have actually found this forum to be the best source of tips and tricks.  Just enter something in the search option and see what comes back;  this is true whether your question is about basic MVD functionality or related to scripting or sql problems.

I think one of the first projects that most of us end up writing is our own tips and tricks application!

In terms of learning more about MVD scripting - for me, the best way was to download other people's projects and see how they had done things.  And then if I am still struggling, I simply ask the question in the forum and Dmitry or one of the other Users will usually reply to you with lots of different ways to do things.

Don't worry about asking what might seem very simple or basic questions - we were all beginners at one point.

Regards,
Derek.

2,203

(26 replies, posted in General)

Hi Adam,
Does this fix things? (I've only changed it for the purchases, not for the sales).
Derek.

2,204

(2 replies, posted in General)

Hello Teco049,
The attached project might give you some ideas.
Rather than have one tablegrid changing to show another tablegrid, I have done an example showing 3 tablegrids that are linked.
But if your design is such that you need to place one tablegrid on top of another, it is not a problem (the processing logic is just the same as in my example).
I hope this helps,
Derek.

2,205

(4 replies, posted in Script)

Hello Prahousefamily, Jean,
Attached is a VERY simple example (that my grandson uses for his Lotto numbers)!
Maybe it can give you a bit of help.  But I don't know how you can code for a range where the min number doesn't begin at 1 (ie 1000-5000).
Perhaps Dmitry has a proper solution.
Regards,
Derek.
.
Jean,
Is Randomrange(x,y) supported in MVD?  I have tried to use it but with no success.

2,206

(2 replies, posted in General)

Hi Heribertom,
Perhaps this is the sort of thing that you are looking for (see attached).  I have tried to use your screen shot as a guide but may have missed something.
Please note that if you are using an older version of MVD (2.5 or older, I think), this solution may not work.
Also note that in the combobox for hotels, I use both the hotel name and location (because there will presumably be more than one 'Sheraton' (for example), and you wouldn't know which one to choose otherwise).
Hope this is clear but if you have any questions, please just ask.
Derek.

2,207

(8 replies, posted in SQL queries)

Hello Mr Slim,
You could try doing something like this (please see attached) but there are many other ways.
The following users/passwords have already been set up:
Derek / 123
Neil / 456
Sam / 789
Peter / 111
Ken / 321
Dave / royce
Slim / mvd
In my example, a user who enters a password incorrectly 3 times is also removed from the drop-down list but you might choose to do it differently.
Hope this helps,
Derek.

Hi Senorlocksmith,
Your script is fine - I think I would just add  a condition and a where clause.  There are probably other ways to achieve it too but this seems the most straightforward way to me.
Please have a look at the attachment and see if this is the sort of thing that you are trying to do.
Hope this helps,
Derek.

2,209

(3 replies, posted in General)

Hi Adam, EHW,
EHW is right - form1.tabsheet1.enabled := false works.  I realise in my earlier post I was testing for an incorrect condition (idiot!).
Just to clarify (please see attached)
1.  form1.tabsheet1.enabled := false will disable all fields on a tabsheet but leave everything (fields and tabsheet frame) visible
2.  form1.tabsheet1.tabvisible := false will make both fields and tabsheet frame invisible
3.  form1.tabsheet1.visible := false will make the fields invisible but keep the tabsheet frame visible
Apologies for any confusion.
Derek.

Hello,
Do you mean saving a record by checking a checkbox?
If so, you could use a hidden 'save' button.
See attached,
Derek.

2,211

(7 replies, posted in General)

Hello Manix,
You need to de-select the "go select full row" object property for the tablegrid (I have changed this setting in your project - also see the screen shot in the attachment).
I have also added a small script so that the cursor is placed automatically in the tablegrid when you run your application (but this is not necessary, more cosmetic).
Hope this helps,
Derek.

2,212

(2 replies, posted in General)

Hi Manixs,
Have a look at the attachment.
Right-click on any row and select "Show On Map" to see an embedded static map based on the post code of the selected row. 
If you want to see an interactive map, click on the 'Interactive Map' button at the bottom left of the static map. 
I wanted to embed an active map into my program rather than make an external call but hit problems.
Anyway, maybe this will be of some help to you,
Regards,
Derek.

2,213

(4 replies, posted in General)

Hi,
This way keeps the script small but I'm sure there are other approaches.
Derek.

2,214

(6 replies, posted in General)

Hi Adam,
Does the attached come closer to what you want?
If you select a purchase invoice from the grid, the frminvoice screen has a 'purchase refund' option.  The same goes for a sales invoice.
If the 'purchase refund' button is clicked, the button caption changes to 'Save Purchase Refund' and the transaction type changes to a 'Purchase Refund'.  The same goes for the 'sales refund' button.
If you select a purchase invoice refund, it automatically uses the originating purchase invoice as a cross reference.   The same goes for a sales invoice refund.
Because the script references the originating transaction automatically, I guess you don't need to be toggling the refund panel off and on (I've commented it out in the script).
The script itself is pretty messy now but there seemed little point in tidying it up until you're sure it's doing what you need.
Please note that on frminvoice, the 'purchase refund', 'sales refund', 'save purchase refund' and 'save sales refund' buttons all overlay one another (just in case you're wondering where they've all gone - LOL!).
Regards,
Derek.

2,215

(2 replies, posted in General)

Hi Nitin,
Here is a password prompt example.
There are concerns about hard coding the password into a script where it might be visible - it all depends on how sophisticated you want to get but you said you needed something simple. 
The password has been set to 'nitin'.
Hope this helps,
Derek.

2,216

(6 replies, posted in General)

Hi Adam,
You could try something like this (see attached).  There's probably other(better) ways to do it but it seems to work.
I haven't looked at anything like negating values etc - just did the actual copy/create.
Hope this helps,
Regards,
Derek

2,217

(2 replies, posted in General)

Hi Adam,
Is this the sort of thing you're after?  (see attachment)
I've changed your code so that it triggers 'on click' rather than 'on afterclick' and also store which of the buttons has been clicked in a variable.
Derek.

2,218

(3 replies, posted in General)

Sorry Adam, only just noticed that you'd already fixed it yourself.
Derek.

2,219

(3 replies, posted in General)

Hi Adam,
Not sure if this is what you're after.
Not sure how it ties in with your incremental search on Button4 though.
Regards,
Derek.

2,220

(7 replies, posted in General)

Hi Kim,
In Dmitry's solution to your 'pending' question, he needs to use a row in 'subrecords' to then read itself - once to calculate the running total and once to filter all the records that are <= to the particular date of the row.
You can't DIRECTLY refer to the same table twice (it would be ambiguous) so you need to redefine it when it's referred to a second time. 
So when he writes '.....from subrecords s........', he is redefining the second use of 'subrecords' as 's' and then subsequently uses 's.id_cereal=subrecords.id_cereal.id' etc etc.  He could just as easily have redefined it as 'subrecords2' but 's' is easier!
.
As a side issue, I often redefine tables when writing a query or script - not because I'm referring to the same table more than once, but simply to save typing (such bad habits)!  Have a look at the code below:
.
select
a.record_count,
a.salutation,
a.name,
strftime('%d-%m-%y', a.joined),
b.type,
a.phone,
a.email,
a.id
from members a, model b
.
which does exactly the same as -
.
select
members.record_count,
members.salutation,
members.name,
strftime('%d-%m-%y', members.joined),
model.type,
members.phone,
members.email,
members.id
from members, model
.
Hope all of that makes sense.
Regards,
Derek.

2,221

(2 replies, posted in General)

Hi Kim,
Good spot.
I've always associated my 'dbupdates' with tablegrid 'changes' or 'clicks' before and never thought to try 'dbupdates' on the 'delete' afterclick.
Thanks for having a look.
.
.
Dmitry,
No need for you to have a look - the problem has been sorted.
.
Regards,
Derek.

2,222

(2 replies, posted in General)

Hi Dmitry,
In my application, I have a form with a parent grid and a child grid. 
The parent grid has calculated fields that count the number of child records, number of child records with certain conditions etc etc. 
If I add child records, the calculated fields in the parent grid update correctly. 
If I amend child records, the calculated fields in the parent grid update correctly. 
But if I delete a child record, the parent grid does not get updated (please compare screenshots 'patients1' and 'patients2').  I need to quit the application completely and re-run it. 
I have dbupdate statements in the script which normally corrects these problems.
Could you please have a look at the attached application and see if there is anything wrong.
Thanks,
Derek.

2,223

(7 replies, posted in General)

Hi Kim,
Thanks for the screenshot - I can see exactly what you're wanting to show and I'm sure it can be done as a calculated field but I've not been able to get the syntax correct.
Pretty sure Dmitry will have a way around it.
Derek.

2,224

(7 replies, posted in General)

Hello Jean,
Thanks, I know about 'form1.combobox1.texthint' but I think this is something that only works with later versions of Windows (Vista and above?).
Some of the users I write stuff for still use XP!
Derek.

2,225

(7 replies, posted in General)

Hi Adam,
Yes, I thought it was probably for that reason.
Please have a look at the attached (specifically the combobox on form2).
1.  I actually set 'combobox first item empty' to be false in the object properties (sounds stupid, right!! - LOL) and also set the 'sorted' object property.
2.  I then have an entry in the combobox list that is the 'help' that you want to display. 
3.  Enter the 'help' with a leading space or asterisks or something like that and it forces it to the top of the combobox list and so looks like a 'help' message.
4.  Add a small script to test (on 'save') whether the user has tried to use the 'help' message as a valid selection.
Alternatively, just use a text hint - not quite the same effect but much quicker!
Regards,
Derek.