Re: [Database] Retrieving sql statement result

2010-04-28 Thread Marcello Bertoli
On 28/apr/2010, at 11.12, Sarah Reichelt wrote:

 If you check the result after your revExecuteSQL statement, it
 should contain the data you need.

Hi Sarah,

thank you for your answer.

the result of revExecuteSql doesn't seem to contains the information the sql 
engine answers and I need to retrieve.

the listen command in postgresql returns text data. For example the sql result 
of the statement:

listen foo;

is

LISTEN

or 

LISTEN
Asynchronous notification foo received from server process with PID ...

I need to retrieve this result text. If I execute:

revExecuteSQL connectionId, listen foo

and I check the result, it is 0, according to the documentation which says 
that for successful query the result is the number of rows affected and for 
other (successful) statements is 0.

Any idea?

Thanks again
Best Regards
Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


[Database] Retrieving sql statement result

2010-04-27 Thread Marcello Bertoli
Hi all,

I have a question about runrev database commands. Is there a way to get the 
result of a sql statement that doesn't retrieve data (is not a select)? For 
example:

In a postgresql scenario I need to execute the statement:

listen foo

and I need to retrieve the result.

It seems that the only rev command I can use is revExecuteSql but in this way I 
can't get the result the sql engine gives after the statement is executed. 
revDataFromQuery seems to work only for retrieving data from a query, not from 
a statement...

Any ideas?

Thanks in advance
Best Regards

Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid sorting

2010-04-26 Thread Marcello Bertoli
On 23/apr/2010, at 21.46, Andre.Bisseret wrote:

 Actually, to do a multi-criteria sorting (here two criteria) one must sort 
 firstly by the second criteria, then by the first one. So that one gets the 
 names in alphabetical order inside each date. So a mixt of my two proposal 
 seems to do the trick ( In fact it suffices to inverse the order of the two 
 dispatch lines in the last script I send you (as they were in the first 
 proposal); 

Thanks Andre,

your code seems to do the trick! I tried also with 3 criteria.


 [...]
  if theColumn is date then
 dispatch sortByColumn to the target with name ## second criterium
 --wait 1 sec
 dispatch sortByColumn to the target with date ## first criterium
  end if
   end if
 end mouseDown


Actually I don't understand one thing: the wait 1 second statement. If I 
leave this statement commented the code doesn't work. If I activate it, 
everythings works... Can you explain me what the wait does in this particular 
scenario?

Best Regards
Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid sorting

2010-04-26 Thread Marcello Bertoli
On 26/apr/2010, at 15.13, Andre.Bisseret wrote:

 A while later, trying to comment it, I discovered that it was working without 
 any wait as well!!!
 I must confess that I am unable to explain why.
 
 I must add that the data grid I am using for trials has only 9 rows (3 dates 
 with 3 names each)! could be the wait is necessary with much more rows(?)
 
 As it is working for me with or without wait, I can't test; but you might 
 try a far less long delay in the wait to get it unnoticeable!: something like 
 wait 1 (means 1 tick). Seems I have read somewhere that even wait 0 could 
 works as it forces the two commands to be strickly successive.

I used a wait 100 millisec for a datagrid with 500 rows. Probably it is related 
with the number of rows a datagrid has...

Thank you very much again!

Best Regards
Marcello

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid sorting

2010-04-26 Thread Marcello Bertoli
On 26/apr/2010, at 18.01, Trevor DeVore wrote:

 on SortDataGridColumn pColumn
switch pColumn
case invoice date
SortDataByKey invoice date, ...
SortDataByKey invoice number, ...
HiliteAndStoreSortByColumn pColumn
break
default
pass SortDataGridColumn
end switch
 end SortDataGridColumn
 
 Untested but it should work.

It works...

Thank you very much

Best Regards
Marcello
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid sorting

2010-04-23 Thread Marcello Bertoli
Hi Andre,

thanks again for your kind interest in solving this tricky issue.

I tried your code but the result is the same. It automates the process of 
clicking on two column headers.

What I would like to accomplish is different. I would like to sort with more 
than one criteria my datagrid rows when I click the header of the column date. 
Here there is an example of the scenario I would like to accomplish (look at 
the first two rows in both examples:

Number   DateCustomer
1   01/01/2010  aa
2   01/01/2010  bb
3   01/01/2010  
4   02/01/2010  aaa
5   02/01/2010  bbb

I would like that when I sort by date, the data can also by sorted by (for 
example) customer (On the same date, the data must sorted alfabetically by 
Customer)

With your code (or with the default sorting code of datagrid) the result is 
this:

Number   DateCustomer
2  01/01/2010  bb
1   01/01/2010  aaa
3   01/01/2010  
4   02/01/2010  aaa
5   02/01/2010  bbb

I can accomplish what I need querying the database with something like:

select number, date, customer from invoices order by date asc, customer asc

I think that, apart from the sql query, there are two chances:

1. The datagrid code can itself manage muti criteria sorting (maybe here Trevor 
can give us a hint)
2. We have to process the array of the datagrid, sorting with multicriteria and 
then populate again the datagrid with the new array.

Any idea?

Best regards
Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid sorting

2010-04-22 Thread Marcello Bertoli
Hi Andre,

thank you very much for your answer. I tried your code but it doesn't do the 
job. It is like pushing the column header of the datagrid two times (first the 
number one and the the date one).

My data come from a sql base so I can (as Steven said) make the query do the 
work of the multiple sorting before loading into the datagrid but I'm scared 
about performances when it comes to manage hundreds of thousands of data. In 
this scenario I need to retrieve data from the sql base and then populate the 
datagrid every time I need to sort the rows without the data I already have in 
the datagrid. This means more traffic over the network and multiple populations 
of the datagrid...

Best regards
Marcello



On 21/apr/2010, at 19.33, Andre.Bisseret wrote:

 I think yes! Assuming for instance you want the dates sorted from the oldest 
 down to the more recent
 and then, for each date, the numbers should be sorted from the smaller down 
 to the greater
 you should sort the numbers column first then the dates' column.
 Something like that:
 
 on mouseUp
 ##setting the sort type value for each column
   set the dgColumnSortType[date] of grp datagrid 1 to system dateTime
   set the dgColumnSortType[number] of grp datagrid 1 to numeric
   set the dgColumnSortType[title] of grp datagrid 1 to text
 ## making sure the two columns will have the same sortDirection if necessary
   set the dgColumnSortDirection[date] of grp datagrid 1 to ascending
   set the dgColumnSortDirection[number] of grp datagrid 1 to ascending
 ## sort number first then date
   dispatch sortByColumn to grp datagrid 1 with number
   dispatch sortByColumn to grp datagrid 1 with date
 end mouseUp
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Datagrid sorting

2010-04-21 Thread Marcello Bertoli
Hi all,

I need to sort the lines of a datagrid with more than one criteria.

For instance:

The datagrid represents invoices with these columns:

- invoice date
- invoice number
- invoice title

When I click on the invoice date header I would like to sort the lines of the 
invoice datagrid first by invoice date and then by number.

Is it possible?

Thanks in advance
Best
Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Cross-Platform encoding issues

2010-04-02 Thread Marcello Bertoli
Hi Devin,

Thank you very much for your help. I'm working on the same project as Jacopo.

The problem is that we need to filter only an occurrence of the euro character, 
not the whole field. The user can write in many situations the euro character 
where he wants, as many time he wants. Besides we need to apply the unicode 
transformation not directly in fields but in variables as we have lots of 
routines that take the fields values, put them in variables and only after a 
few transformations write them to the sql database.

Is there a way to actually deal with the unicode content of a variable?

Thanks in advance
Best
Marcello

On 31/mar/2010, at 22.53, Devin Asay wrote:


 Yes, the html entity for the Euro symbol is problematic and inconsistent 
 between mac and windows. But this works on both Mac and Windows (beware word 
 wrap):
 
 set the unicodeText of fld test to uniencode((numToChar(226)  
 numToChar(130)  numToChar(172)),utf8)
 So as long as you store the characters sequence corresponding to ascii 226, 
 130, and 172 in your database you should be able to render them successfully.

 On Mar 31, 2010, at 6:30 AM, Jacopo Lupi wrote:
 
 Hi all,
 
 I'm building a cross-platform application based on an postgresql database.
 
 The postgresql database encoding is utf8. The revclient sets the 
 client_encoding of the postgres session to latin9 and if it is running 
 on mac it translates the data with mactoiso or isotomac functions. I 
 need to set the postgres client_encoding to latin9 otherwise I can't 
 retrive text with accents correctly on the macplatform.
 
 Everything seems to work fine exept for the euro symbol. I can find no way 
 to type the euro symbol in mac and make it readable under windows and 
 viceversa.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Datagrid edit cell question

2010-03-25 Thread Marcello Bertoli
Thanks Trevor for your help.

the dgColumnIsEditable did the trick!

Marcello

On 24/mar/2010, at 20.37, Trevor DeVore wrote:

 On Mar 24, 2010, at 3:33 PM, Marcello Bertoli wrote:
 
 I have some questions about editing data directly inside datagrids.
 
 The scenario is a datagrid where the user can edit only certain columns. 
 I've accomplished this turning off the allow text editing of the datagrid 
 and allowing the text editing of the column I want in the mouseDoubleUp 
 handler. Here it is a sample code:
 
 I think that setting the dgColumnIsEditable to false for the columns you 
 don't want to edit should do the trick. Try that. Docs are on this page:
 
 http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7343-Data-Grid-Properties
 
 -- 
 Trevor DeVore
 Blue Mango Learning Systems
 ScreenSteps: http://www.screensteps.com
 Releasable Revolution Resources for Developers: 
 http://revolution.bluemangolearning.com
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Datagrid edit cell question

2010-03-24 Thread Marcello Bertoli
Hi all,

I have some questions about editing data directly inside datagrids.

The scenario is a datagrid where the user can edit only certain columns. I've 
accomplished this turning off the allow text editing of the datagrid and 
allowing the text editing of the column I want in the mouseDoubleUp handler. 
Here it is a sample code:

on mouseDoubleUp pMouseBtnNum
   dgMouseDown pMouseBtnNum
   if the dgHeaderControl of the target is empty
  if pMouseBtnNum is 1 then
 put the dgColumn of the target into tColumn
 put the dgHilitedIndex of the target into tIndex
 switch tColumn
case column I don't want to edit
   exit mouseDoubleUp
   break
default
   EditCellOfIndex tColumn, tIndex
 end switch
  end if
   end if
   
Is it the best way to manage my purpose or are there better methods?

Actually if I cicle through the columns of a datagrid row with the tab key I 
can edit the columns I don't want to edit. I've tried to solve the problem with 
this code:

on preOpenFieldEditor pFieldEditor
   switch the dgColumn of the target
  case Column I dont'want to edit
 send DeleteFieldEditorAndOpenNext to the dgControl of me in 0 seconds
 break
  [...]
   end switch
end preOpenFieldEditor

It actually works but:

1. I don't know if it is the best way to manage the problem
2. I see that the focus is sent to the column I don't want to edit and then 
the cursor jumping to the column I actually want to edit.

I would like not to see this effect. I would like the cursor jumping directly 
to the cell of the column where the user can insert data without this 
unpleasant graphic effect. Is there a way to accomplish this?

Thanks in advance
Cheers
Marcello___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution