You may be interested to try the following code:
SearchString=hk_this.show_stringvaluedialog("Enter search string")
myfilter="Bezeichnung like " + "'%"+SearchString+"%'"
whatfilter=hk_thisform.datasource().filter()
#hk_this.show_warningmessage(myfilter)
hk_thisform.datasource().set_filter(myfilter,False)
hk_thisform.datasource().disable()
hk_thisform.datasource().enable()
#hk_thisform.show_asdialog()
Good luck
Robert Leleu <[EMAIL PROTECTED]> wrote: Egbert Eissing a écrit :
> Dear Robert Leleu,
> Thanks very much for your help.
> I have followed your advise and my problem has been solved.
> However, I have also made some alteration, instead of loading
> all the data, and then going to the required record, I have modified
> the script in the opening form to do a filtering instead. Here is the
> code from the on_open event of the opening form:
>
> hk_thisform.set_mode(hk_thisform.designmode)
>
> file=open("/home/egbert/tmp/memoire.txt")
> MusikID=file.read()
> file.close()
>
> myfilter="MusikID = " + MusikID
>
> hk_thisform.datasource().set_filter(myfilter,False)
> hk_thisform.datasource().disable()
> hk_thisform.datasource().enable()
> hk_thisform.set_mode(hk_thisform.viewmode)
>
> I am not terribly happy with the use of an external file to carry the
> information forward, it would be better if it could be passed internally
> from the calling form to the opening form. Maybe this will be implemented
> with the next release of Knoda.
>
> Thanks again
> Egbert
>
>
Happy to have been useful, that's a trick I used previously with Windev,
much more easy to use...but not free stuff....and only windows...
Now,....I tried the use of a filter, ( being new user of Knoda I was not
even aware of this function), but did not succeed.
But I must first clarify a bit about the way I used the find function,
which functions with partial match.
I set the main table as datasource for the form to open, and a query
involving the main table and secondary ones as the datasource of a
posting field in the form (from which the user will copy the result).
There is a connection from the table to the query.
This query is the datasource of the main form which displays the general
list in a gridfield, and is eventually sorted when I select the row I want.
When I used find directly on the query, it would find 1434 when asked
for 34, because sorting the query from the main form had placed the valu
1434 before the 34.....So I had to "find" on the table (which is not
sorted), and due to the connection the query is positionned on the right
row with the requested value in the field to be find.
That's indeed awkward, so I think that the filter way is much more clever.
However...here is my code (in the Onopen of the posting field)
myfilter="idkleunik = " + idchoisi
hk_thisform.datasource().set_filter(myfilter,False)
hk_thisform.datasource().disable()
by the way what's the utility of these 2 lines?
hk_thisform.datasource().enable()
#hk_thisform.set_mode(hk_thisform.viewmode)
hk_this.show_warningmessage(hk_thisform.datasource().name())
this return the
correct name of the datasource, my query
hk_this.show_warningmessage(" row
"+str(hk_thisform.datasource().row_position()))
this return 0
hk_this.show_warningmessage("filtre defini par:
"+hk_thisform.datasource().filter())
this return "idcleunik"=815 (for instance, and that's the right value)
hk_this.show_warningmessage("idcleunik="+hk_thisform.datasource().column_by_name("idcleunik").asstring())
this returns nothing
Should you have an idea of where I'm wrong, it would be great!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss
---------------------------------
Yahoo! Answers - Get better answers from someone who knows. Tryit now.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss