DEFAULT_WHERE [message #334975] |
Sat, 19 July 2008 00:43 |
|
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 #334991 is a reply to message #334989] |
Sat, 19 July 2008 02:21 |
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 #335004 is a reply to message #335002] |
Sat, 19 July 2008 05:03 |
|
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 #335112 is a reply to message #335099] |
Mon, 21 July 2008 01:06 |
|
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 |
|
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 #335166 is a reply to message #335158] |
Mon, 21 July 2008 05:15 |
|
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 |
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 |
|
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 |
|
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 #335213 is a reply to message #335205] |
Mon, 21 July 2008 08:27 |
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 |
|
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 likeWHERE 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 |
|
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 #335414 is a reply to message #335398] |
Tue, 22 July 2008 02:21 |
|
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 |
|
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).
|
|
|
|
|