Home » Developer & Programmer » Forms » how to query new inserted record
how to query new inserted record [message #160514] Mon, 27 February 2006 01:25 Go to next message
juicyapple
Messages: 92
Registered: October 2005
Member
I created a form which read data in text file and insert to database. After insert the new record, I would like to show it on the form automatically without user query it.

the codes like below,

/* inserting data here */
go_block('block1');
:block1.ID := <new inserted id>;
execute_query;
hide_window('block2');

The code doesn't work, please give some comment, which is wrong here?

Thanks.
Re: how to query new inserted record [message #160516 is a reply to message #160514] Mon, 27 February 2006 02:00 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If <new inserted id> is known, you should change block's DEFAULT WHERE property so that 'block.id = new inserted id' and THEN execute the query.
Re: how to query new inserted record [message #160518 is a reply to message #160516] Mon, 27 February 2006 02:11 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member

The new Id is not default, so I can't set the where property to one value.

Please advise.

Thanks.
Re: how to query new inserted record [message #160521 is a reply to message #160518] Mon, 27 February 2006 02:28 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I didn't think "new ID" has default value, but unless you know it, you (generally speaking) can't perform query and fetch this record WITHOUT setting the block DEFAULT WHERE property.

Did you read about DEFAULT WHERE property, anyway? Because I have a feeling that you didn't understand what I'm talking about ...
Re: how to query new inserted record [message #160671 is a reply to message #160514] Tue, 28 February 2006 00:21 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please supply more code. If you are reading a file then you must have a loop. Unless you want a message 'Do you want to save your data?' then I suggest issuing a 'commit' before doing the execute_query.

By the way, in what way is the code not working? What are you seeing?

David

Upd: spelling.

[Updated on: Tue, 28 February 2006 20:04]

Report message to a moderator

Re: how to query new inserted record [message #160675 is a reply to message #160671] Tue, 28 February 2006 00:40 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
Thanks for your reply.
I briefly describe my code..

There are two data block, blockA and blockB.
In blockB, when-button-pressed trigger is raised,
program will begin with
1.open text file
2.get text line
3.insert data to tableA
4.commit
5.go_block('blockA')
6.blockB.Id := <new Id>
6.execute_query
7.hide_window('canvas_blockB')
8.end

Sorry if my description is not clear..
Hope to hear your ideas.
Re: how to query new inserted record [message #160676 is a reply to message #160675] Tue, 28 February 2006 00:42 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
typing mistake..should be

6.blockA.Id := <new Id>
Re: how to query new inserted record [message #161258 is a reply to message #160514] Thu, 02 March 2006 20:18 Go to previous messageGo to next message
juicyapple
Messages: 92
Registered: October 2005
Member
Does anyone have idea? My problem still haven't been solved.
:<
Re: how to query new inserted record [message #161530 is a reply to message #161258] Sun, 05 March 2006 23:22 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What message are you getting? What does not work? Is the data not in the data base? If you want to search for the new data then do an enter_query, assign the data to :blockB.id, then do the execute_query. Alternatively, use set_block_property ('blockB', default_query,'you work out the string'); then do the execute_query.

David
Previous Topic: hi
Next Topic: Regarding List Item
Goto Forum:
  


Current Time: Fri Sep 20 05:52:40 CDT 2024