Home » Developer & Programmer » Forms » Save > Delete > Save > Insert
Save > Delete > Save > Insert [message #510035] Thu, 02 June 2011 04:44 Go to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Hi Guys,

I'm little confuse why is it happening.
After I put some values on Text Items then I press Save
which query is:

:QASYS_REWORK.area_id := :rework.area_no;
:QASYS_REWORK.area_desc1 := :BUYOFF_DTL.area_desc;
:QASYS_REWORK.pt_no := :rework.mo_number;
:QASYS_REWORK.date_created := sysdate;
:QASYS_REWORK.flex_value := :rework.flex_value1;
:QASYS_REWORK.flex_value_desc := :rework.description;
:QASYS_REWORK.qty_rework := :rework.qty;
:QASYS_REWORK.qa_no := :temp.qano;
commit;

I think the inserting process is not a problem.
then I checked my table if its inserted, no data at all.
But recently, I figured out on how it is inserted, ACCIDENTALLY.
I put some values then I pressed SAVE then I pressed DELETE accidentally, then I SAVEd it again, then I checked my table, it inserted.

DELETE query is simple as this:

begin
delete_record;
end;

Wondering why is it inserting after I deleted the record?
Hope someone can help me.

Thanks & Regards,
Faith





Re: Save > Delete > Save > Insert [message #510036 is a reply to message #510035] Thu, 02 June 2011 04:53 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Try using commit_form rather than commit.
Re: Save > Delete > Save > Insert [message #510040 is a reply to message #510036] Thu, 02 June 2011 05:07 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

yeah. it works! but some values from text_item didn't appear in my table. Sad
Re: Save > Delete > Save > Insert [message #510041 is a reply to message #510040] Thu, 02 June 2011 05:14 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'll need more information than that if you want help fixing it.
Are they database items?
Re: Save > Delete > Save > Insert [message #510043 is a reply to message #510041] Thu, 02 June 2011 05:18 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

database items? I think so. from BLOCKS.
what are the basic reasons why I got those outputs?
Re: Save > Delete > Save > Insert [message #510045 is a reply to message #510043] Thu, 02 June 2011 05:22 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
You think so? Check in the property pallette!

Your insert wasn't firing when you expect because commit doesn't cause forms to apply changes to datablocks to the DB. Commit_form does.
Re: Save > Delete > Save > Insert [message #510197 is a reply to message #510045] Thu, 02 June 2011 19:25 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

good morning!
I checked the property of all my BLOCKS.
all of them is allowing insert process..
Its like that my delete process is refreshing
the insert process.
Re: Save > Delete > Save > Insert [message #510221 is a reply to message #510197] Fri, 03 June 2011 00:09 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
faithima
I checked the property of all my BLOCKS.

You should have checked ITEMs' properties (whether their "Database Item" properties are set to "Yes" or not).
Re: Save > Delete > Save > Insert [message #510226 is a reply to message #510221] Fri, 03 June 2011 00:26 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Database Item of all my needed Items are set to 'YES'.
Re: Save > Delete > Save > Insert [message #510234 is a reply to message #510226] Fri, 03 June 2011 01:39 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Back to beginning: for example, this line (that belongs to WHEN-BUTTON-PRESSED trigger on the "Save" button - at least, that's what I understood):
:QASYS_REWORK.area_id := :rework.area_no;

Two blocks: QASYS_REWORK and REWORK. Are they database blocks? If so, which tables are they based on?
AREA_ID item: its "Database item" property is set to "Yes", right? Can you see its value when querying the table (in SQL*Plus)?


Quote:
but some values from text_item didn't appear in my table.

Which items, exactly?

What is your Forms version? If 10g, run the form in debug mode. Perhaps you'll find something interesting.
Re: Save > Delete > Save > Insert [message #510241 is a reply to message #510234] Fri, 03 June 2011 03:45 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Versions:

Form v5.0.6.8
Oracle7 Server Release 7.3.4.0.0

I'll upload my screen shots.
Re: Save > Delete > Save > Insert [message #510243 is a reply to message #510241] Fri, 03 June 2011 03:49 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

/forum/fa/9054/0/

Below are the list of Text Items that
is not appearing when insert fires:
> Flex
> Description
> Qty

  • Attachment: mYD1XePl.jpg
    (Size: 86.85KB, Downloaded 1116 times)
Re: Save > Delete > Save > Insert [message #510245 is a reply to message #510243] Fri, 03 June 2011 03:52 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
That really doesn't tell us much.
What datablocks do you have?
What tables are they based on?
What's their database property set to?
Are there relationships defined between the blocks?
Are there other items in the datablock the three items above belong to?
What trigger is the commit_form in?
Re: Save > Delete > Save > Insert [message #510246 is a reply to message #510245] Fri, 03 June 2011 04:00 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

1. What datablocks do you have?
2. What tables are they based on?
3. What's their database property set to?
4. Are there relationships defined between the blocks?
5. Are there other items in the datablock the three items above belong to?
6. What trigger is the commit_form in?


1. Datablocks is came from the table in database. (Is there kinds of datablocks?)
2. Don't understand what you mean. sorry.
3. All of them are set to 'YES'.
4. None
5. Yup! Another table.
6. On the SAVE Button.
Re: Save > Delete > Save > Insert [message #510248 is a reply to message #510246] Fri, 03 June 2011 04:06 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
faithima wrote on Fri, 03 June 2011 10:00

1. Datablocks is came from the table in database. (Is there kinds of datablocks?)

I'll rephrase - how many datablocks do you have? And yes there are other types, you can base blocks on procedures.

faithima wrote on Fri, 03 June 2011 10:00

2. Don't understand what you mean. sorry.

You know that blocks are based on tables in the DB. Which tables are your blocks in your form based on. That's a really simple question.

faithima wrote on Fri, 03 June 2011 10:00

4. None

That might well be the problem.

faithima wrote on Fri, 03 June 2011 10:00

5. Yup! Another table.

That would mean you have a datablock based on two tables.
Flex, description and qty are in a datablock - are there any other items in that datablock? And what is the block called?

faithima wrote on Fri, 03 June 2011 10:00

6. On the SAVE Button.

Post the full code - use code tags.


EDIT: added some blank lines

[Updated on: Fri, 03 June 2011 04:09]

Report message to a moderator

Re: Save > Delete > Save > Insert [message #510252 is a reply to message #510248] Fri, 03 June 2011 04:28 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member


I'll rephrase - how many datablocks do you have? And yes there are other types, you can base blocks on procedures.

>> I've got 9 Datablocks. Now I know that there are other types of datablocks. Thanks!


You know that blocks are based on tables in the DB. Which tables are your blocks in your form based on. That's a really simple question.

>> the qasys_rework & the rework table.


That might well be the problem.

>> Maybe I can relate the two table.



5. Yup! Another table.

That would mean you have a datablock based on two tables.
Flex, description and qty are in a datablock - are there any other items in that datablock? And what is the block called?

>> buyoff_dtl. it also came from database.

6. On the SAVE Button.
Re: Save > Delete > Save > Insert [message #510254 is a reply to message #510252] Fri, 03 June 2011 04:32 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
faithima wrote on Fri, 03 June 2011 10:28

5. Yup! Another table.

That would mean you have a datablock based on two tables.
Flex, description and qty are in a datablock - are there any other items in that datablock? And what is the block called?

>> buyoff_dtl. it also came from database.

And is buyoff_dtl being inserted correctly?

faithima wrote on Fri, 03 June 2011 10:28

6. On the SAVE Button.


Are you repeating what I say for a reason?
Post the code
Re: Save > Delete > Save > Insert [message #510255 is a reply to message #510252] Fri, 03 June 2011 04:36 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Not necessarily related to your problem, but - how many forms did you create BEFORE this one?
Re: Save > Delete > Save > Insert [message #510256 is a reply to message #510254] Fri, 03 June 2011 04:41 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Are you repeating what I say for a reason?
Post the code

Yup! When I do the save > delete > save.
It inserted correctly.

Actually i'm annotating your work.
I forgot to quote.

[Updated on: Fri, 03 June 2011 04:42]

Report message to a moderator

Re: Save > Delete > Save > Insert [message #510257 is a reply to message #510255] Fri, 03 June 2011 04:44 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Forms? Actually this is the 2nd time.
Yeah I know..I'm just a beginner.
I'm more on discoverer and report oriented.
Sorry for the disturb.

[Updated on: Fri, 03 June 2011 04:46]

Report message to a moderator

Re: Save > Delete > Save > Insert [message #510258 is a reply to message #510257] Fri, 03 June 2011 04:52 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, 9-blocks-form is quite a complex form, so I thought that you'd rather - if possible - try with something easier, to learn how Forms work, how it does certain things, what features it offers by default. Maybe you are coding something that you shouldn't (so, if you let Forms Wizard do that for you, you wouldn't even have those problems).

Is there nobody there, who knows Forms? Can't you ask him/her to assist?

Now it is kind of difficult to debug what we don't see. Even if we did, we don't have your tables, your data, so ... quite a stalemate situation. I'm afraid it will take considerable time to fix what is wrong.
Re: Save > Delete > Save > Insert [message #510259 is a reply to message #510258] Fri, 03 June 2011 04:57 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Yeah..quite disappointed..Sad
But its ok..taking time to help somebody is great thing.
Maybe i'll try to re-do my work.
I've got my due date on Monday..my gosh!haha
Thanks anyways..Smile
Re: Save > Delete > Save > Insert [message #510260 is a reply to message #510257] Fri, 03 June 2011 04:57 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Do you actually understand what I mean when I say post the code?
The save button has a when-button-pressed trigger, that trigger contains some code.
I want you to copy and paste that code here so we can see it.

Quote:

Yup! When I do the save > delete > save.
It inserted correctly.


All the data? some of the data?
Re: Save > Delete > Save > Insert [message #510263 is a reply to message #510260] Fri, 03 June 2011 05:02 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

oh..i'm sorry..
POST THE CODE..right!

I posted it on the very first part..that's the query inside the smart trigger.
All of the data is inserted when I do the save > delete > save.
Re: Save > Delete > Save > Insert [message #510266 is a reply to message #510263] Fri, 03 June 2011 05:16 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In one of your previous messages (the one with a screenshot), you said that FLEX, DESCRIPTION and QTY values are not saved. Which block do these items belong to? Is it REWORK or QASYS_REWORK?

The very first message in this thread names all items but those three, so *maybe* your code misses
-- This is what you have:

 :QASYS_REWORK.area_id := :rework.area_no;
 :QASYS_REWORK.area_desc1 := :BUYOFF_DTL.area_desc;
 :QASYS_REWORK.pt_no := :rework.mo_number;
 :QASYS_REWORK.date_created := sysdate;
 :QASYS_REWORK.flex_value := :rework.flex_value1;
 :QASYS_REWORK.flex_value_desc := :rework.description;
 :QASYS_REWORK.qty_rework := :rework.qty;
 :QASYS_REWORK.qa_no := :temp.qano;

-- This is what you might need to add:

 :QASYS_REWORK.FLEX := :REWORK.FLEX
 :QASYS_REWORK.DESCRIPTION := :REWORK.DESCRIPTION;
 :QASYS_REWORK.QTY := :REWORK.QTY;

-- Finally, commit:

 commit_form;

Or, if that's not the case, did you check the right table? Maybe these items (FLEX, DESCRIPTION, QTY) belong to another table?

[Updated on: Fri, 03 June 2011 05:16]

Report message to a moderator

Re: Save > Delete > Save > Insert [message #510267 is a reply to message #510266] Fri, 03 June 2011 05:22 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

:QASYS_REWORK.flex_value := :rework.flex_value1;
:QASYS_REWORK.flex_value_desc := :rework.description;
:QASYS_REWORK.qty_rework := :rework.qty;

how should I explain..hmmm..
the qasys_rework.so on are the corresponding fields in their table.
I'm sure that it i'm on the right table. Smile

I really have to go back from scratch..Sad
it's ok..don't bother answering my post.
what have you shared is enough for me to have the idea.
Thanks!
Re: Save > Delete > Save > Insert [message #510268 is a reply to message #510267] Fri, 03 June 2011 05:25 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, so it means that items from the screenshot belong to REWORK block (and its underlying table). What table is it? Are you sure you selected data from that table (when verifying that everything is where it should be)?
Re: Save > Delete > Save > Insert [message #510279 is a reply to message #510268] Fri, 03 June 2011 06:52 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
I would assume the screenshot block is QASYS_REWORK. The code populates all the items in the block that aren't on screen.
However that code only populates the items in the current record in the block.
It's a multi-record block.
So if you've entered 10 records and then click the save button it'll only assign values to those items in the 10th record.
It'll leave those items blank in records 1-9.

Assuming I'm right all the code that assigns values to items in the QASYS_REWORK block should be moved from the when-button-pressed to the pre-insert trigger on that block.
Re: Save > Delete > Save > Insert [message #510354 is a reply to message #510279] Fri, 03 June 2011 20:24 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Hi To All,
I got it already.
I start from scratch then I do the commit_form.
Thanks Littlefoot & Cookiemonster!
I haven't try the pre-insert. I will try it later.
But still it is inserting if I deleted. Very Happy

[Updated on: Fri, 03 June 2011 21:42]

Report message to a moderator

Re: Save > Delete > Save > Insert [message #510358 is a reply to message #510354] Fri, 03 June 2011 22:08 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
But still it is inserting if I deleted

Why wouldn't it? For example: if you entered 10 records into that block and performed DELETE_RECORD, that would delete one of them. SAVE would still save 9 remaining records.
Re: Save > Delete > Save > Insert [message #510361 is a reply to message #510358] Fri, 03 June 2011 22:19 Go to previous messageGo to next message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Nice! Problem Solved! Thanks guys!
I just need a little trappings to avoid duplicates. Smile
Well, I think I can manage with this one.
Many thanks for the help. Smile
Re: Save > Delete > Save > Insert [message #510362 is a reply to message #510361] Fri, 03 June 2011 22:34 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm glad you managed to solve the problem. See you again, I suppose.
Re: Save > Delete > Save > Insert [message #510363 is a reply to message #510362] Fri, 03 June 2011 23:06 Go to previous message
faithima
Messages: 37
Registered: April 2011
Location: Philippines
Member

Namaste Smile
Previous Topic: How to design a Simple Graph
Next Topic: static ip
Goto Forum:
  


Current Time: Thu Sep 12 08:55:48 CDT 2024