26

(4 replies, posted in General)

Destiny wrote:

Hello, I know how to avoid duplicates in a table but how to modify an existing record and replace it.

this is vague. are you perhaps looking for script? sql query?
if sql query, then you can use UPDATE or INSERT OR REPLACE query.

Something like...

INSERT OR REPLACE INTO `yourtable`(id, yourfield) VALUES (1, 'test2');

or

UPDATE `yourtable` SET `yourfield`='test2' WHERE id=1;

27

(1 replies, posted in General)

if you know how sqlite works then attaching database will be your best option.

https://myvisualdatabase.com/forum/view … 553#p46553

28

(27 replies, posted in General)

don't show the calculated field on the grid, you can always show the fields(ones that is on the database) e.g. on the example, the info1 and info2. then edit them. calc fields only work as a view.

29

(27 replies, posted in General)

tcoton wrote:

Beware, if you are using 2 calculated fields using a trim on different fields, you will be able to filter the grids with a text field but you won't be able to edit due to a SQL error telling you that one of the column does not exist. IT looks like the calculated fields are all charged in memory during the application initialization and there can be some mix up. I had to rethink some of my design where I could make a lot of scripts disappear ... but had to redo it.

when you say editing, are you perhaps put the calc field on a component(e.g. TEdit) in a form and add it on the save or make it editable on a grid? That won't work. If you are familiar with SQL, then that calculated field is only an alias, so it is really not in database. It's like SELECT trim(ifnull(info1||'§','')||ifnull(info2||'§','')) AS calcfield FROM yourtable. calcfield is not in database but is only in the result of your query

30

(27 replies, posted in General)

derek wrote:

Hi Both,
I was thinking along the lines of concatenated fields in a calculated field and not using a script at all (see attached).
Be careful with the script option as it could be case sensitive.
Regards,
Derek.

This one rocks. Derek have unlimited imagination.

31

(27 replies, posted in General)

tcoton wrote:

OK. Looks like I have no other choice but to keep it in the script...  The one in attachment is working as intended.

Good to know, but if you really hate it to have query on the dcu, then embed it on the form.xml. imagination is the key. It'll be visible also but i think it'll be hard.

32

(27 replies, posted in General)

That's one of MVD's limitation I think. Just do some script and do make use advantage of the Tablegrid dbFilter.

33

(8 replies, posted in General)

here's another example of script to force the checked row as selected before executing the delete function

34

(8 replies, posted in General)

jean.brezhonek wrote:

Hello pozidis

The check mark allows you to visually select the lines of a grid on which you want to apply an action (move, delete, edit on a state, etc.).

It does the same job as the Multi-Select option but without its visual aspect.
JB

the default delete function of the button doesn't really delete the checked ones with this #checkbox, so it needs to be done via script unfortunately.

35

(8 replies, posted in General)

Care to elaborate on what you really want to do? for multi-delete, you really don't need that checkbox actually, Just checking grid property Additional > Options > goMultiSelect, you can have your multi-delete. using the button. you can simply select by clicking while holding your keyboard's Shift(select all from the selected to the next row to select) or Ctrl(individually selecting row). You need to do some scripting for other checkings you want to do before deleting. You can also click one record from the grid and hit Ctrl+A to select all rows.

36

(6 replies, posted in General)

it is a constant. stores value(in that case, an integer) such as integer, string, real, etc...
it is accessible all through out your script in any function or procedure.

i want storing such value in the constant so that later on, i can only set it in the top.

4 is the column index on the grid. so say for example you change the arrangement of the grid, like adding a column before the current index 4, all you have to do is change the constant value, then all is well.

check that i used the constant ID_IDX in different procedures

Form1_Button5_OnClick
Form1_TableGrid1_OnChange
Form1_Button4_OnClick
Form1_Button6_OnClick

I could just set it to its corresponding value(4) like for example

SQLExecute('DELETE FROM Names WHERE id='+Form1.TableGrid1.Cell[4,i].AsString);

and in the other procedure but, then, when you decided to re-arrange your grid (like adding a column), what will happen is you will have to look on all the procedure with that index 4 and a big chance(this happens a lot) to omit some value that needs updating and sometimes it'll not throw an error, but will give an unexpected or unnoticeable output and will eat your time to just looking for that code/s.

Check on the Settings of the TableGrid1, notice that I added Names.id right after Names.tsek  it is at 5th column (index:4)

37

(6 replies, posted in General)

here's one.

38

(8 replies, posted in General)

I think it is better to make a simple test on the problem you encountered (incompatible "extended" type). It is faster to spot the problem in this way.
If the output is can be done by a simple search, then make use of it. making it to script is a last resort for me.

39

(11 replies, posted in General)

I cannot find or test the Property for the ParentCombobox.

dbFilter is a better workaround for me. It's powerful and can be used in so many way.

40

(5 replies, posted in General)

but if you really want to have the minimal keyboard interaction when changing the uses, then i'm thinking something like this

procedure m(aMsg: Variant);
begin
    ShowMessage(VarToStr(aMsg));
end;
procedure xm(aMsg: Variant);
begin
    // do nothing
end;

m(1);
m('two');

xm(1);
xm('two');

adding/removing x before the test will just take 1 keystroke from your keyboard. rather than delete, then typing 1 or 0.

41

(5 replies, posted in General)

im using a similar procedure to this one.

procedure sm(aMsg: Variant);
begin
    ShowMessage(VarToStr(aMsg));
end;

sm(1);
sm('two');

i'm curios to what will be the use case of v: integer.
are you perhaps want to disable the message before deploying your application?
if so, I would rather comment the line, than looking for all my uses of the procedure

begin
    // ShowMessage(VarToStr(aMsg));

or if you want to keep the test, then why not just comment the line of the test.

sm(1);
// sm('two');

42

(6 replies, posted in General)

You need to execute it

43

(4 replies, posted in General)

been working with fastreport embedded in MVD for couple of years now and I just learn this trick now. Thanks sparrow.

44

(2 replies, posted in General)

Thank you for this one. Will add this as a reference.

45

(2 replies, posted in General)

Hello. Is there anyone know what was used in the functions EncryptRC5, EncryptFileRC5, DecryptRC5 and DecryptFileRC5? I want to access encrypted file/String from this function and access it on my Delphi application.

Thanks in advance.

46

(3 replies, posted in General)

Hello. Dmitry do have official statement on not continuing MVD. But it is a mature one. I've built several database applications with this one. For me, having developing on Delphi for quite some time now is a plus. MVD for me rocks if you want to develop standalone database applications. Shifted to Delphi due to software requirements, If the map just been updated, this is solid.

http://myvisualdatabase.com/forum/viewt … 720#p45720

47

(1 replies, posted in General)

Hello, Is DynamicWrapperX not working? It throws error Invalid class string ProgID: DynamicWrapperX.

I want to load dll function on my application.

48

(5 replies, posted in General)

oh. nevermind. got it working. thanks to chatgpt. smile it is a server side thing. just change to mysql_native_password on your mysql 8 yves if it is not a big deal on the security measures of your mysql database server and you can connect to it. thanks CDB. been looking for this for quite sometime now.

49

(5 replies, posted in General)

CDB wrote:

There is the possibility you need to change the Authentication method,  I have used v8.0 with MVD some time ago and I had to set the authentication method to the legacy type.

do you perhaps have with you a snippet or sample on how to change the auth method?

50

(2 replies, posted in General)

derek wrote:

Hi Brian,
Not sure if this is what you need

chart.view3d := false;

Regards,
Derek.

this is neat, thanks derek. I think ill just have a toggle button to do the trick. but if there are other options that can retain 3d and just remove shadow, that'll be awesome.