Home » Developer & Programmer » Forms » DEFAULT_WHERE (forms 6i,oracle 9.2.0.1 ,win xp)
DEFAULT_WHERE [message #334975] Sat, 19 July 2008 00:43 Go to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

online_papers

PAPER_ID COURSE_ID QUESTIONS OPT1 OPT2 OPT3 OPT4
1 1 what is 2+3? 4 5 6 2
2 1 what is 2*3? 4 6 5 2
3 1 what is (2*3)+(3*2)? 20 10 12 24
4 2 what is sin90? 180 1 0 90
5 2 what is cos90? 0 1 180 90
6 2 what is tan 45? 0 1\2 1\4 1
7 3 Find the square root of 121? 12 11 10 13
8 3 Find the square root of 36? 9 3 6 8
9 3 Find the cuberoot of 125? 2 5 3 6


online_course
COURSE_ID COURSE EXAM_PAPER
1 maths m1
3 maths m3
2 maths m2
4 english e1
5 english e2
6 english e3
7 science s1
8 science s2
9 science s3



in QNS1 form i have created a datablock online_papers
paper_id database item
qns database item
opt1 database item
opt2 database item
opt3 database item
opt4 database item

with radio group RG and 4 push buttons which are
start
next
previous
finish.

what my requirement is i have to return the questions n options for the user selected course (which i got thru courseid from previous form).


in the start button i written a query which follows
begin
set_block_property('online_papers',DEFAULT_WHERE,'paper_id in(select paper_id from online_papers where course_id =:global.cou)');
execute_query;
end;



but this code is not working.
give me some hints to solve this problem.

PFA jpeg file to see my qns forms in run time.
thanks in advance.
  • Attachment: untitled.JPG
    (Size: 40.92KB, Downloaded 701 times)
Re: DEFAULT_WHERE [message #334989 is a reply to message #334975] Sat, 19 July 2008 02:20 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

hello members ,

if u want more details i will let u know.

thanks in advance
Re: DEFAULT_WHERE [message #334990 is a reply to message #334975] Sat, 19 July 2008 02:21 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
explain "is not working"

Why do you set that where-clause at runtime? It never changes, does it?
Re: DEFAULT_WHERE [message #334991 is a reply to message #334989] Sat, 19 July 2008 02:21 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
seyed456 wrote on Sat, 19 July 2008 09:20
hello members ,

if u want more details i will let u know.

thanks in advance

Not even two hours, on a Saturday.
Have patience or hire a consultant.
Re: DEFAULT_WHERE [message #335000 is a reply to message #334991] Sat, 19 July 2008 03:57 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

i set the where clause not at run time. but in item level at push button.
Re: DEFAULT_WHERE [message #335002 is a reply to message #335000] Sat, 19 July 2008 04:41 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
And when do you push that button?
At design-time or at run-time?
So, when is the default where set?
Re: DEFAULT_WHERE [message #335004 is a reply to message #335002] Sat, 19 July 2008 05:03 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks for your response frank.
i push the start button at run time.
i thought to use trigger in block level .but i was not sure.
i got only these 2 options.
Re: DEFAULT_WHERE [message #335005 is a reply to message #335004] Sat, 19 July 2008 05:21 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Why do you SET it at run-time.
Why not set it in the property-block in Forms Builder. Why use a trigger?
icon10.gif  Re: DEFAULT_WHERE [message #335006 is a reply to message #335005] Sat, 19 July 2008 05:30 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

with out using of trigger how do i achieve that please give me a hint.
Re: DEFAULT_WHERE [message #335007 is a reply to message #335006] Sat, 19 July 2008 05:37 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
What did you try yourself in the NINE(!) minutes between my answer and your question?
Re: DEFAULT_WHERE [message #335008 is a reply to message #335007] Sat, 19 July 2008 05:47 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

i was thinking of on populate trigger n tried to implement in block level.
Re: DEFAULT_WHERE [message #335099 is a reply to message #335008] Mon, 21 July 2008 00:24 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

can i give it in where clause of the block in property pallete ??

pls tell me .
Re: DEFAULT_WHERE [message #335112 is a reply to message #335099] Mon, 21 July 2008 01:06 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
First of all, please, PLEASE, read the OraFAQ Forum Guide; pay attention to "How to format your post" section. It will help you properly display information in a readable way.

As an illustration, this is how your post looks like:

PAPER_ID COURSE_ID QUESTIONS OPT1 OPT2 OPT3 OPT4
1 1 what is 2+3? 4 5 6 2

and this is how it is supposed to look like:
PAPER_ID COURSE_ID QUESTIONS    OPT1 OPT2 OPT3 OPT4 
-------- --------- ------------ ---- ---- ---- ----
       1         1 what is 2+3?    4    5    6    2

See the difference?

Next time, please, do it yourself (if you expect any kind of help).

Now, as of your question about use of the DEFAULT_WHERE clause: I didn't pay much attention to what's been said previously, but I have noticed that you didn't use the correct syntax to do the job. SET_BLOCK_PROPERTY should concatenate the fixed part of the WHERE clause with a variable one. So, instead of
'paper_id in (select paper_id from online_papers where course_id = :global.cou)'
try with
'paper_id in (select paper_id from online_papers where course_id = ' || :global.cou || ')'


Re: DEFAULT_WHERE [message #335130 is a reply to message #335112] Mon, 21 July 2008 02:37 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks little foot. i already done it in where clause of property
pallete in block.


i have a problem with my calling form.

from one form im calling another form
by call_form('emp'); but its not executing automatically .
when im clicking execute button its getting executed in RUN time.
how do i automatically execute the query in database block of calling form ???


thanks in advance.
Re: DEFAULT_WHERE [message #335158 is a reply to message #335130] Mon, 21 July 2008 04:43 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Put EXECUTE_QUERY into the WHEN-NEW-FORM-INSTANCE trigger.
Re: DEFAULT_WHERE [message #335166 is a reply to message #335158] Mon, 21 July 2008 05:15 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks alot.

since i was using that inside item level.

the final and lost form i created is qns1 form,
aftr the completion of exam im returning the result when finish button being pressed,

i written the query

BEGIN
   GO_ITEM ('m');
   CLEAR_ITEM;

   SELECT COUNT (*)
     INTO :m
     FROM onlin_master m, candidate c, onlin_enroll e
    WHERE m.ans = c.ans AND m.paper_id = c.paper_id AND e.exam_id = c.exam_id;

   IF :m <= 2
   THEN
      MESSAGE ('BETTER LUCK NEXT TIME');
      MESSAGE ('ONLY   ' || :m || '   QUESTIONS ARE CORRECT');
      MESSAGE ('ONLY   ' || :m || '   QUESTIONS ARE CORRECT');
   ELSIF :m > 2
   THEN
      MESSAGE ('CONGRATULATIONS');
      MESSAGE (:m || '   QUESTIONS ARE CORRECT');
      MESSAGE (:m || '   QUESTIONS ARE CORRECT');
   END IF;
END;


i have created a text button called m,
when im passing the result into m ,its add up with the existing
result ,i tried of using clear_item. but i cudnt .
update allowed property in the block level is turned on,
why clear_item is not working.give me some hints .

thanks in advance
Re: DEFAULT_WHERE [message #335194 is a reply to message #335166] Mon, 21 July 2008 07:03 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Why clear it if you're filling it directly afterwards?

Make it a habit to use block.field notation in Forms, (e.g. in the go_item)

One question: Are you developing Forms for a living?
Re: DEFAULT_WHERE [message #335196 is a reply to message #335166] Mon, 21 July 2008 07:06 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

this is the form i created .
in the finish button i written a code.
where u check out .

when im pressing the finish button it returns me the summed up value which are previously passed into text item M. i mean if u had scored 3 in previous run , when u finish up this time run u have scored 2, the message im getting is 3+2 5 questions are correct.

pls help me.
thanks millions in advance.
  • Attachment: QNS1.fmb
    (Size: 64.00KB, Downloaded 1093 times)
Re: DEFAULT_WHERE [message #335199 is a reply to message #334975] Mon, 21 July 2008 07:10 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks frank for your response.
Im doing one small project.
Am at the final stage.


i tried of using blockname.field name in go_item.
still its not get cleared.


when passing after wards it get summed up with previous value which i passed in the past runs .
Re: DEFAULT_WHERE [message #335201 is a reply to message #335199] Mon, 21 July 2008 07:26 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Are you sure your QUERY is correct?
Doesn't that combine multiple tries?
Re: DEFAULT_WHERE [message #335205 is a reply to message #335201] Mon, 21 July 2008 07:44 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

i think so .if mistakes there please give me a hint .
Re: DEFAULT_WHERE [message #335213 is a reply to message #335205] Mon, 21 July 2008 08:27 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
18 minutes between replies..
You really don't get it, do you?
Who is the one having a problem here? Who needs to solve this? Who should be able to solve it, even if your internet-connection fails and OraFAQ and other forums become unavailable?
Re: DEFAULT_WHERE [message #335300 is a reply to message #335196] Mon, 21 July 2008 15:02 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
when im pressing the finish button it returns me the summed up value which are previously passed into text item M. i mean if u had scored 3 in previous run , when u finish up this time run u have scored 2, the message im getting is 3+2 5 questions are correct.


PL/SQL code used in the form suggests different - there's no code that adds one (previous) result tho the other (current) one. The only piece of code that populates the "m" item is the SELECT COUNT(*) statement. It implies that, as Oracle doesn't lie, you got it wrong.

Obviously, there really ARE 5 records in these tables (FROM onlin_master m, candidate c, onlin_enroll e) that satisfy the condition (WHERE m.ans = c.ans AND m.paper_id = c.paper_id AND e.exam_id = c.exam_id).

I believe that COUNT(*) picked up all correct answers; if you'd run the form again and correctly answered (for example) 4 questions, the result would have been 9 (3 in the first attempt, 2 in the second and 4 in the third one)(3 + 2 + 4 = 9).

If that's correct, it seems that you'll have to adjust the WHERE clause in a way that only the current quiz session is counted. Something like
WHERE m.ans = c.ans 
  AND m.paper_id = c.paper_id 
  AND e.exam_id = c.exam_id
  AND some_table.some_column = :some_form_block.some_block_column       <-- 
Re: DEFAULT_WHERE [message #335392 is a reply to message #334975] Tue, 22 July 2008 01:05 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks for your response little foot,

but in where clause which column i have to add up .
im thinking a lot despite none can match up.can i add up one more column in the table ???
Re: DEFAULT_WHERE [message #335398 is a reply to message #335392] Tue, 22 July 2008 01:12 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member


can i add the text box M in where the clause ???
i dnt think it would be suitable option.
Re: DEFAULT_WHERE [message #335414 is a reply to message #335398] Tue, 22 July 2008 02:21 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks for all your help.
finally i got the answer.

WHERE m.ans = c.ans 
  AND m.paper_id = c.paper_id 
  AND e.exam_id = c.exam_id
  and c.exam_id =(select max(exam_id)
                  from onlin_enroll e
                  e.user_name = :global.abc --username for the session
                 )



thanks a million times especially little foot n frank.

[Updated on: Tue, 22 July 2008 02:22]

Report message to a moderator

Re: DEFAULT_WHERE [message #335415 is a reply to message #335398] Tue, 22 July 2008 02:23 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
can i add up one more column in the table?
I don't know; if you are the owner, you could. If not (and you don't have required privileges), you'd have to ask the owner to do it for you.

Quote:
can i add the text box M in where the clause ??? i dnt think it would be suitable option.
You can, of course. But that doesn't make any sense (just as you've said).

In other words: if there's no column which can uniquely identify the current "answering" session, you'll either have to create it, or completely delete a table (so that it is empty for each session).

Now, deleting is a bad idea if there is more than a single user who is using this form (and a table). You could, though, create a global temporary table (GTT) instead of the one you are using now. Doing so, every user would see only his/her own data set (although all of them would be using the same table). Also, you wouldn't have to add another column (unless you want to keep some kind of a history, but I guess that GTTs are out of question in that case).
Re: DEFAULT_WHERE [message #335445 is a reply to message #335415] Tue, 22 July 2008 03:55 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

thanks for your feed back.

i gone through this link.
http://www.psoug.org/reference/gtt.html


once i will learn this n try to implement .
if any doubts arises i will let u know.
Re: DEFAULT_WHERE [message #335446 is a reply to message #335445] Tue, 22 July 2008 03:58 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, no problem.
Previous Topic: many of keyboard shortcuts don't work when NumLock was turned on
Next Topic: timer expired example
Goto Forum:
  


Current Time: Fri Sep 27 14:24:40 CDT 2024