Topic: Change Grid cell text
Hi,
Is there anyway to change a grid cell text using Script?
Cannot find any property
Many thanks
My Visual Database → Script → Change Grid cell text
Hi,
Is there anyway to change a grid cell text using Script?
Cannot find any property
Many thanks
Hi,
There are different ways to do this.
Which is best depends on what you're actually doing - updating a specific cell or any highlighted cell etc.
I'm guessing that you're wanting to both change the grid cell text AND save it rather than just changing it (otherwise there's little point LOL!).
Have a look at the attached as one option (enter your next text in the edit field and then click in the appropriate cell.
Wow,
Many Many Thanks
I have a question,
this
Main.TransGrid.Cells[9,i] := 'Nein';
return an error and said Nein is not integer!!!!!!
before update to v6 this one was ok but now its not working anymore
How can I fix it?
Many thanks
Hi Sonixax,
Works okay for me (Windows10 and MVD 6.5) - see attachment.
Maybe upload your project to see if there is something else going on.
Derek.
Hi Sonixax,
Works okay for me (Windows10 and MVD 6.5) - see attachment.
Maybe upload your project to see if there is something else going on.
Derek.
Sure,
Attached you can find the project.
Many thanks
Hi,
I'd be tempted to use calculated fields to hold Ja and Nein for the 'checked' field and to hold Einnahme and Ausgabe for the 'type' field.and it makes the script a bit simpler.
Derek.
Hi Derek, Sonixax
Sonixax, In Derek's project
In Button12 please modify SQL Query
SELECT
"$autoinc"
,strftime('%d.%m.%Y', Ennahmeausgabe.datum)
,Ennahmeausgabe.belegnr
,kontakt.fullname
,(SELECT kontakt.fullname FROM kontakt WHERE id = id_kontakt1)
,Ennahmeausgabe.grund
,CASE WHEN Ennahmeausgabe.type = 0 THEN Ennahmeausgabe.amount ELSE Ennahmeausgabe.amount * -1 END
,CASE WHEN Ennahmeausgabe.type = 0 THEN Ennahmeausgabe.amount_dol ELSE Ennahmeausgabe.amount_dol * -1 END
,CASE WHEN Ennahmeausgabe.type = 0 THEN 'Einnahme' ELSE 'Ausgabe' END
,CASE WHEN Ennahmeausgabe.checked = 0 THEN 'Nein' ELSE 'Ja' END
,Ennahmeausgabe.id
FROM Ennahmeausgabe
LEFT OUTER JOIN kontakt ON kontakt.id = Ennahmeausgabe.id_kontakt
WHERE
(CASE WHEN {ComboBox1} <> -1 then {ComboBox1} = id_kontakt else 1=1 end) OR
(CASE WHEN {ComboBox1} <> -1 then {ComboBox1} = id_kontakt1 else 1=1 end)
ORDER by Ennahmeausgabe.datum asc
AND comment lines in the two place in the script
// Main.TransGrid.Cells[6,i] := '-'+Main.TransGrid.Cells[6,i];
// Main.TransGrid.Cells[7,i] := '-'+Main.TransGrid.Cells[7,i];
It remains to deal with the colors of the cells. I think that you will do it yourself.
But keep in mind that you have coloring in two places.
In the table event handler and in the Button12 button handler. They can interfere with each other))).
Have a look at this: http://myvisualdatabase.com/forum/viewtopic.php?id=5402
I have a question,
thisMain.TransGrid.Cells[9,i] := 'Nein';
return an error and said Nein is not integer!!!!!!
before update to v6 this one was ok but now its not working anymoreHow can I fix it?
Many thanks
You cannot write a text value to a Boolean field.
There are several solutions:
1. Add an empty text field to the query and then enter a text value into it.
2. Form the desired text directly in the SQL query using the CASE command like Sparrow writing
Sparrow, Derek, k245.
Many many thanks for your support
Everything now working perfectly, I just have another question which is need another topic.
Many thanks again.
My Visual Database → Script → Change Grid cell text
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi