76

(9 replies, posted in General)

my mistake was, i used coediting and it enabled editing, only after using "allowedit" option on tablegrid coediting was used to disable editing

77

(9 replies, posted in General)

One last question Dmitry, i have to save the tablegrid using a "save button" right?
i'm having problems with this... it gives me an sql error: Insert into orcproforma (the table is right) (id_orcproforma) this doesn't make sence , value 46
It should be insert into orcproforma id 46

78

(9 replies, posted in General)

btw you mean

    Form1.TableGrid1.Columns[0].Options := Form1.TableGrid1.Columns[0].Options - coEditing;
    Form1.TableGrid1.Columns[1].Options := Form1.TableGrid1.Columns[1].Options - coEditing;
and not gridsearch rigvht?

79

(9 replies, posted in General)

wow, fast reply! thanks!

80

(7 replies, posted in Script)

that's it! many thanks

81

(9 replies, posted in General)

Hello there, is it possible to edit JUST one specific collum on the tablegrid? (i'm talking about the allowedit tablegrid options)

82

(8 replies, posted in Script)

hi Mathias. thanks for your help.

My question is after filling the localarray with all these id's, (and it seems that i can get an i to c do to grab all id's from a tablegrid into an array, so that's half of the problem solfed, how do i use this "data" to , for example, add lines into a memo ? if i know how to do this i'll learn how to write the correct sql message.

Many thanks

83

(7 replies, posted in Script)

hi Dmitry.

Would  SQLExecute('SELECT COUNT(Quant) FROM stock WHERE id IN (1, 4, 7, 9) work if i use the var id in Where id in +id ?

84

(7 replies, posted in Script)

Hello.
First of all, i'm very very very sorry to bother everyone in the forum.
I probably should say this but i am not a programmer, at least not before i started using my visual database, i started learning a little bit about delphi and sql,  but i am still newbie , and i don't have a professional method to do what i want.

Saying this, i am stuck in a part of my project.

Here's what i need to know:

- How do i retrieve all id's from a tablegrid?

i know sqlvalue gives me the id for the selected row, but how do i retrieve all the id's from one tablegrid?

- How do i count multiple quantities with SQL?

i know that i can use SQLExecute('SELECT COUNT(Quant) FROM stock WHERE upper(Quant)=upper("'+id+'"); (Where ID var is the SQLValue
But this only gives me one count, can i use something like Where upper(quant)=upper(1,3,7,14 etc...?); And if i can do this, how can i then count the individual quantities to check if they are below 0?

- How do i update multiple quantities into SQL?

After counting the avaiable stock, i will want to update the values with the new quantities, if so, can i use commas to seperate the diferent id's ?
something like: SqlExecute('Update Stock Set Quant ' 1,2,3,5 Where Id = 1,3,7,14); and if i do this will id 1 have 1 quantity, id 3 have 2 quant, id 7 have 3 and id 14 have 5 ? or will this not work?


After knowing all this, all i need to know, is how can i use this new info to update the stock when someone accepts an invoice.
That's all i need to finaly finish my project! big_smile

Please help me, and i'll be eternatly grateful!

85

(8 replies, posted in Script)

Mathmandu, i need an example, can you send me your project, or a similar project that uses this? thanks

86

(8 replies, posted in Script)

mathamandu, is results a string or an array?

87

(9 replies, posted in Script)

ah Derek, yes i saw your example, yes i will use just one sql table, but i am using two tablegrids , so that's the mix up smile

88

(9 replies, posted in Script)

Thanks Derek, let me take a look at it.

I Think that i know how to do this in my mind, but i need to take a look at examples.

I have a table with invoices, i have invoice nº1, invoice nº2, and invoice nº3 for THIS customer.
Customer accepts invoice nº3 , i then  use a combobox that allows me to tell that invoice nº3 is the way to go.
So..., i then have a script that automaticly checks if everything that i put on invoice nº3 is in stock, and retrieves those items from the stock, if something is 0 it then adds what parts i need to continue my order.

The problem is that i have several lines on invoices, otherwise it would be easy

I need somethign that can read all the id's , and do a batch job sql updating every single id to their new quantities...

would any of you guys help me put this into a few code lines so i can start messing arround?
Cheers

89

(3 replies, posted in Reports)

nevermind, i don't know why i didn't use join this time...

now it works:

SELECT
orcamento.descricao,
orcamento.quantidade,
orcamento.precounitario,
orcamento.preco,
orcamento.precocomiva,  
assistencia.data,
Assistencia.record_count,
Clientes.Nome,
Clientes.Empresa,
Clientes.Nif,
Clientes.Email,                            
Clientes.contacto1,
Assistencia.diagnosticocliente,                                                                                                                                                                                                
Assistencia.nserie,
Assistencia.taxaurg,                                          
Assistencia.Reincidencia,
Assistencia.Autorização,
Assistencia.Backup,
Assistencia.Acessórios,
Assistencia.Danos,
Assistencia.Avaria,
Assistencia.SelodeGarantia,
tipo.tipo,
marca.marca,
modelo.modelo,
                                                                                                             
(CASE assistencia.backup  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end ),                                
(CASE assistencia.taxaurg  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end),
(CASE assistencia.autorização  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end ),
(CASE assistencia.reincidencia  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end)                              


FROM orcproforma

LEFT OUTER JOIN orcamento on orcamento.id_orcproforma = orcproforma.id
LEFT OUTER JOIN assistencia on assistencia.id = orcproforma.id_assistencia              
LEFT OUTER JOIN clientes on assistencia.id_clientes = Clientes.id   
LEFT OUTER JOIN tipo on assistencia.id_tipo = tipo.id                              
LEFT OUTER JOIN marca on assistencia.id_marca = marca.id                               
LEFT OUTER JOIN modelo on assistencia.id_modelo = modelo.id    

WHERE orcproforma.id={TableGridpreorc}
 

90

(3 replies, posted in Reports)

ah... but i have found a small problem with  my query.

I have two selections, but only the first one shows on record data on report.
The second one doesn't show up, but the sql query doesn't give me any errors.
Should i put everything between ( ) ' s?

SELECT  
orcamento.descricao,
orcamento.quantidade,
orcamento.precounitario,
orcamento.preco,
orcamento.precocomiva

FROM orcamento

Where orcamento.id_orcproforma={TableGridpreorc}; 

///// ONLY THIS FIRST PART SHOWS UP ON REPORT, AFTER THIS LINE NOTHING SHOWS ON RECORD DATA
                                                 
SELECT
assistencia.data,
Assistencia.record_count,
Clientes.Nome,
Clientes.Empresa,
Clientes.Nif,
Clientes.Email,                            
Clientes.contacto1,
Assistencia.diagnosticocliente,                                                                                                                                                                                                
Assistencia.nserie,
Assistencia.taxaurg,
Assistencia.Reincidencia,
Assistencia.Autorização,                                                            
Assistencia.Backup,
Assistencia.Acessórios,
Assistencia.Danos,
Assistencia.Avaria,
Assistencia.SelodeGarantia,
tipo.tipo,
marca.marca,
modelo.modelo,

                                                                                                             
(CASE assistencia.backup  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end ),                                
(CASE assistencia.taxaurg  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end),
(CASE assistencia.autorização  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end ),
(CASE assistencia.reincidencia  WHEN 1 THEN 'Sim' WHEN 0 THEN 'Não' ELSE '' end)                              

FROM assistencia                                                                                                                                                      


LEFT OUTER JOIN clientes on assistencia.id_clientes = Clientes.id   
LEFT OUTER JOIN tipo on assistencia.id_tipo = tipo.id                              
LEFT OUTER JOIN marca on assistencia.id_marca = marca.id                               
LEFT OUTER JOIN modelo on assistencia.id_modelo = modelo.id


WHERE assistencia.id=$id


                                                                                                       
                                                        

 

91

(3 replies, posted in Reports)

nevermind, i found it , it works the same way as the examples for the comboboxes, i uses {tablegrid} on my report sql sentence, and it finds the new id for the new table. i just had to select the names from the table where id = tablegrid

92

(3 replies, posted in Reports)

Hello, i have an SQL Report that is working wonders, but i want to change one thing: I want to get two different id's, the main id from the technical maintance , i get this id from maintance.id=$id , but i also want to get another id from a second selected tablegrid, this tablegrid doesn't have a relationship with the maintance.id, it's independent.
How can i choose it's id? Tablegrid.sqlvalue doesn't seem to work on sql report, is there a way?

93

(1 replies, posted in General)

ahhh there's .visible and there's tabvisible lol
nevermind! should have read a little bit more before posting, my bad

94

(1 replies, posted in General)

hi there, i am strugling to make my tabs disapear with .visible , even .enabled doesn't seem to work.
Is this a bug or am i supose to do something else?
CHeers

95

(0 replies, posted in General)

Hello, i have a combobox and i want to apply a filter to it that only shows records from a table, that has the same ID as the curent form.

I tried

orcproforma.assistencia_id = assistencia.id
but it doesn't work
neither $id , or just id or even main.tablegridassistencia.sqlvalue
what am i doing wrong?

96

(9 replies, posted in Script)

i can see what you were talking about.
I want to use something similar for my project, where i have "pre-invoices" and as soon as a customer accepts one of those , it transfers all the info, to the "final invoice"
It should also compare the stock to see if anything falls below 0

97

(8 replies, posted in Script)

you are the best!
I'll take a look at this and try to adapt in my situation.
I want to be able to select everything from a table , and plant it to another.

98

(8 replies, posted in Script)

Hello.
I want to pick ID's from an SQL Execute and add it to the Array of Strings, so i can dump it later into another table.
Is it possible to use Array of Strings? and if so, can anyone give me an example?
Many thanks smile

99

(2 replies, posted in Script)

nice, i'll try, thanks

100

(2 replies, posted in Script)

Hey guys, is there a way to SUM a value each day ? or just with a Report?