?
Solved

View records in form 6i

Posted on 2005-05-02
13
Medium Priority
?
436 Views
Last Modified: 2008-02-01
The scenario is like this
I have three datablock in a formXX
First i open the A datablock and do a sreach for 'DUMMY' which will give me B block with the dummy data
now in that B block i have a COPY_TO button and when i press that it will give me C block
Now i enter data(ex: 12) in the C block and hit OK button which is in C block (that will close C block.)
And i want to go to B block and see only those rows which is i entered now (For example DUMMY data and 12)

I am saying GO_BLOCK(C)
EXECUTE QUERY;

But it shows all the values which entered by others also.

So i want to see only data entered by me in the B block.

Can somebody help me out here.

Thanks a lot in advance.
 
0
Comment
Question by:babunagendra
  • 5
  • 4
  • 4
13 Comments
 
LVL 22

Expert Comment

by:Helena Marková
ID: 13915358
One option is modifying DEFAULT_WHERE property of block B when hitting OK button in block C.
0
 
LVL 1

Accepted Solution

by:
sachinrp earned 1000 total points
ID: 13915435

Hi,

Yes I agree with Henka, You have to modify Block C Properties and give where clause on which you want to filter the records. Else you can use
SET_BLOCK_PRPPERTY(default_where,'x=xx');
Use global variable to assign new values when you press ok button
e.g. on OK button you have to add

:global.val1 := :field1; (DUMMY)
:global.val1 := :field2; (12)
--Then
go_block('C');
clear_block(no_validate);
set_block_property('C',default_where,' '||:field1 = :global.val1||' and '||:field2 = :global.val2||' ');
execute_query;
set_block_property('C',default_where,' '');

Use of set block property is more appropriate in user case , as your where clause will change runtime based upon some values/changes etc.

Hope this will help
0
 
LVL 1

Expert Comment

by:sachinrp
ID: 13915442
Hi -Just realize- use block 'B' instead of C

:global.val1 := :field1; (DUMMY)
:global.val1 := :field2; (12)

go_block('B);
set_block_property('B',default_where,' '||:field1 = :global.val1||' and '||:field2 = :global.val2||' ');
execute_query;
set_block_property('B',default_where,' '');

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:babunagendra
ID: 13915869
S, i think i will try it out but what if they keep entering the data and want to see DUMMY,12 ,34,56,67,78,89..., like this
what i meant is i don't know how many field they want to enter, sometimes they have single project or 10 projects .so at that time how i will write the query.

Thanks.
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 13915931
When a user clicks OK in the C block - you can loop through this block and can create the default_where property of block B like this:
DECLARE
 var_where   VARCHAR2(1000):=' ';
BEGIN
-- block C
FIRST_RECORD;
LOOP
    var_where:=var_where||','||:C.item1;
    EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
    NEXT_RECORD;
END LOOP;
var_where:=':field1 IN '||substr(var_where,2);
set_block_property('B',default_where,var_where);
GO_BLOCK('B');
execute_query;
END;
0
 
LVL 1

Expert Comment

by:sachinrp
ID: 13916082
Not clear about your comments please elaborate more
How many such fields are there ?
do you mean to say  DUMMY,12 ,34,56,67,78,89... are the different records, I.e If I entered 10 records now and When I go back to B , I need to see last 10 records one by one. Or does it mean there are differnt fields .
If you want more than one last records to see , then you might need to add one flag , so that system will know what is 'NEW .
Else you can have NVL function to drop NULL field , Or you can use If-Then
like
If :global.field1 is Not null Then
l_where_clause = l_where_clause ||' and  '||:global.field1 = :field1
ElsIf :global.field2 is Not null Then
l_where_clause = l_where_clause ||' and  '||:global.field2 = :field2

Like This

Please comment


0
 

Author Comment

by:babunagendra
ID: 13923725
i think what u guys say might work for me, but
i wrote set_block_property('blockname' , defalut_where,...........XX)

....XX there what sholud i do

See i want is to see those records(DUMMY , project1,project2 all these record) created by that user . but not by any other
For ex A created project1,project2 and B who is another office created project 10  A should see project 1,project2 ,DUMMYand B should see project10,DUMMY.

0
 
LVL 22

Assisted Solution

by:Helena Marková
Helena Marková earned 1000 total points
ID: 13923913
In such a case you have to add item - "created by": item2 to the B block and use this item as the base default_where of the block B.
In a When-New-Form-Instance trigger you can use:
:global.var_def_where:=Get_Block_Property('B',default_where);

 Then you can modify:
...
var_where:=:global.var_def_where||' AND :field1 IN '||substr(var_where,2);
set_block_property('B',default_where,var_where);

You always know the user - Get_Application_Property(USERNAME);
0
 

Author Comment

by:babunagendra
ID: 13925239
what i understood is i have to add an item createdby to block B and also to that item add a trigger when-New_form..,and assign gobal variable overthere
use this variable in var_where and what sholu i do with the Get_Application_Property(USERNAME);

0
 
LVL 22

Assisted Solution

by:Helena Marková
Helena Marková earned 1000 total points
ID: 13925270
Yes, except that the When-New-Form-Instance trigger is at form level.
Get_Application_Property(USERNAME) returns the user connected to the database.
You can read more about Get_Application_Property() built-in in the Forms on-line help.
0
 

Author Comment

by:babunagendra
ID: 13925719
No what i wan to know is where should i say Get_Application_Property(USERNAME);

0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 13925740
I use it in a When-New-Form-Instance trigger.
0
 
LVL 1

Assisted Solution

by:sachinrp
sachinrp earned 1000 total points
ID: 13933416
ABove code will help, make sure that you are inserting (may be updating) createdby item of block B
to correct username
i.e.
in pre-Insert (and pre-update if appropriate) you have to add code
update block b set createdby = get_application_property(USERNAME) etc.
post;

so that when executing query you can query records related to createdby=get_application_property(USERNAME)




0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this article, we’ll look at how to deploy ProxySQL.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question