How to make null text and image items invisible in run time?? [message #621173] |
Mon, 11 August 2014 02:52 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/5fe54296fab26ada1a2b27b3a9120fb2?s=64&d=mm&r=g) |
utsav0311
Messages: 12 Registered: July 2014 Location: Bangalore,India
|
Junior Member |
|
|
Hello all,
I have a non-tabular(Number of Records Displayed = 1)datablock,B_test which has four Text Items say Item1,item2,Item3 and Item4 and four Image Items say Image1,Image2,Image3 and Image4 . I have a table Employees having Emp_id as one of its column and lets say that the table has only 3 rows and the values for Emp_id is 1,2,and 3.
Now there is one push button which when pressed should get the values of all the emp_id present in the table Employees and Image of those employee (which is available on the hard disk not in the database) into the Item1,Item2,Item3 & Item4 and Image1,Image2,Image3 and Image4,respectively. Obviously,Item4 and Image4 will be null.
I have managed to achieve the first part of it (i.e getting values to the block B_test) and now I want all the null items(Item4 and Image4) to be invisible in my canvas.
Here's this is how I am trying to do it:
Declare
next varchar2(40);-- to hold the values of the system cursor of next item in the B_Test block
lastitem varchar2(40);--to hold the values of the system cursor of last item in the B_Test block
Begin
Go_Block('B_test');
next := :SYSTEM.CURSOR_ITEM;
Go_Item(Get_Block_Property('B_test',LAST_ITEM));
lastitem := :SYSTEM.CURSOR_ITEM;
For i in 1..last_item
Loop
Go_Item(next);
val:= :System.Cursor_value;
If val is null then
message(next||' is null');
set_item_property(:System.Cursor_Item,Visible,PROPERTY_FALSE);-- This gives me the obvious error that Forms cant set invisible property to the current item
Elsif val is not null then
message(next||' is not null');
End if;
NEXT_ITEM;
next := :SYSTEM.CURSOR_ITEM;
EXIT WHEN :SYSTEM.CURSOR_ITEM = lastitem;
END LOOP;
End;
So could you all please help me to get rid of this error.
|
|
|
|
|
Re: How to make null text and image items invisible in run time?? [message #621180 is a reply to message #621177] |
Mon, 11 August 2014 05:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
utsav0311 wrote on Mon, 11 August 2014 10:26Thanks for your concern !!
Actually I have written in that format only but when I posted,somehow it turned into unformatted code.
Then you haven't read the link in the above post, since that shows how to avoid it being unformatted.
utsav0311 wrote on Mon, 11 August 2014 10:26
Anyways,coming to what you have suggested,I have a few basic doubts:
1.If not a LOOP then how can I check till the last item.
Datablocks do not contain random numbers of items, you know exactly what's there so just check each item. Lsat item is irrelevant unless you using a loop.
utsav0311 wrote on Mon, 11 August 2014 10:26
2.Quote:leave the cursor in one of them while making the other invisible. How can I achieve this? I mean I won't be knowing the item name of the null items.
Are you saying there isn't a single not null column there?
utsav0311 wrote on Mon, 11 August 2014 10:26
3.Is there any built-in or anything sort of that which can set invisible property for the next item till the last item of the block.
No. though of course you can use get_item_property to work out what the next_item is.
utsav0311 wrote on Mon, 11 August 2014 10:26
I will be highly obliged if you help me with the coding of the idea which you have suggested.
8 (if necessary) IF statements, each checking one of the items and if it's null setting the item property.
I'm suggesting the most basic code to get the job done, nothing clever.
|
|
|
|
Re: How to make null text and image items invisible in run time?? [message #621186 is a reply to message #621185] |
Mon, 11 August 2014 07:46 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I think you think I mean something more complicated than what I said, when I actually meant exactly what I said. Assuming item1 is not null:
IF :block.item2 IS NULL THEN
set_item_property('blovk.item2', Visible, PROPERTY_FALSE);
END IF;
IF :block.item3 IS NULL THEN
set_item_property('blovk.item3', Visible, PROPERTY_FALSE);
END IF;
........
You've got 8 items. You could have written that in 1 minute and then it would be done.
|
|
|
|
Re: How to make null text and image items invisible in run time?? [message #621260 is a reply to message #621253] |
Tue, 12 August 2014 03:52 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Some things can be worth simplifying when presenting a problem, the number of items in the block you need to make invisble isn't one of them.
Instead of going to each item in turn you can use get_item_property to get the nextitem property and use that to check each item in turn while keeping the cursor in the first item.
|
|
|
|
|
|
|
|
|
|