Search This Blog

Showing posts with label Hiding rows in a grid. Show all posts
Showing posts with label Hiding rows in a grid. Show all posts

Thursday, January 24, 2013

Component Properties: Difference between Search Record and Add Search Record

Below are the Search records we can add through Component properties.


Search Record Name
 Displays the component's default search record when you access the component in update or display mode.

Note. You can assign an override search record to a component at the menu level. If the component uses an override search record, the search record displayed in the Override Search Record will be different from this one and you should search it instead.

Add Search
 Displays the component's search record when you access the component in add mode.


Source of above information: Peoplebooks

When to use Add Search Record?
 In a case where we want to control the data that should be added or for a requirement where we add a counter for the ID.

Lets see a simple example where the Search record and Add Search record is used.

The below Events page helps us to create different types of  Campus Events.

Let's first see how this page works.

Search shows us the list of Campus Events available.
Lets see the data for Event ID 000010005.

 Now, Lets Add a New Event ID. In this case , we use a different Search record because we need to setup a new Event ID.





  Lets see how we can do this in App Designer.

  Below is strucuture of these search records.
 The Standard Search record is a view which retrieves data from primary record of the component.
 For Add Search record, Primary record of the component is used. The EventID is set to '0'  at fielddefault peoplecode. Once the page is saved, the peoplecode in the SavePrechange event will get the most recent Event ID and then adds plus 1. (i.e if recent EventID is 121 ,then new Event ID will be 121 +1 = 122)




Friday, March 9, 2012

Hiding a row in a grid

&rs(&i).visible=false;

"rs" is the rowset of the grid. i.e &rs = getrowset(sroll.RECNAME);
"i" -- represents row of the grid.
 Let us take a scenario where we want to hide employee rows who are contractors
Sample grid data
Sno   Emplid  Name  EmpType
1       14201   Kiran      P 
2       14202   Krishna  C
3       14203   Ravi       P   

Now , I want to hide Contractor. In this case it is Krishna.
So I will traverse through the rowset

Buffer values of the grid before hiding the rows.
1 Kiran
2 Krishna
3 Ravi

for &i=1 to &rs.activerowcount

if  &rs(&i).EMP_HIRE_DTL.EMP_TYPE = "C" then
&rs(&i).visible = false; 
end-if;
end-for;

Buffer values of the grid after hiding the rows.

1 Kiran
2 Ravi
3 Krishna

Hope the above info is useful.