Hide a Grid Column From a Grid in PeopleCode

Your rating: None Average: 3.2 (9 votes)

This code should be helpful if you are trying to hide a grid column using PeopleCode

To
hide a column in a grid (using the Grid and GridColumn objects). You no
longer must loop through every row in the grid and hide that field. Now
you can use the GridColumn property Visible. The Visible property will
also hide grid columns that are displayed as tabs in the PeopleSoft
Internet Architecture.

Local Grid &GRID;
Local GridColumn &COLUMN;
If COMPLETE_FLAG = "Y" Then
&GRID = GetGrid(PAGE.RESOURCE, "GRID1");
&COLUMN = &GRID.GetColumn("COL5");
&COLUMN.Visible = False;
End-If;

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
Guest's picture
Guest (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Anyone know how to center a field on a grid? I've been looking all over the planet for a simple listing of the GridColumn's properties, but can't seem to find them anywhere.

Any help would be EXTREMELY appreciated....

Hari_aindian's picture
User offline. Last seen 3 years 42 weeks ago. Offline
Joined: 08/02/2010
Posts: 84
Re: Hide a Grid Column From a Grid in PeopleCode

Just add few dummy fields in the grid with the intended field.

Position your field at center. Hide the dummy fields in the page.

This way you can make your field to position at center.

Regards,
Hari.A

Guest's picture
Guest (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Hi Lepa,

Is their anything in Grid Properties by which we can arrange the rows for a perticular column in ascending or descending order????

Hari_aindian's picture
User offline. Last seen 3 years 42 weeks ago. Offline
Joined: 08/02/2010
Posts: 84
Re: Hide a Grid Column From a Grid in PeopleCode

Yes. There is a property called Allow column sorting. you need to check this grid property to sort the grid columns at run time.

Regards,
Hari.A

V's picture
V (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Can we expand or collapse a grid using peoplecode?

V's picture
V (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Can we expand or collapse a grid using peoplecode?

Guest's picture
Guest (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Put the Grid in a Group box and Expand/Collapse the group box through PeopleCode may suits for your requirement.

Berry's picture
Berry (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

With regard to the following two lines of code from the above solution:

&GRID = GetGrid(PAGE.RESOURCE, "GRID1");
&COLUMN = &GRID.GetColumn("COL5");

...how does one obtain the grid and column names? I don't see anything useful on the Page Field properties. I've attempted to use the record name, but then the PeopleCode editor barks at me for not also specifying a field. (When I provide a field, the error vanishes, but then the page doesn't do anything either.) If I use string literals, as in the above code, I receive the following error: "A PeopleCode program contains a call to the GetGrid built-in function with invalid parameters. The specified page/grid/occurrence cannot be found."

Thanks in advice.

Berry's picture
Berry (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

The PeopleCode documentation says that the grid name is the "Page Field" name from the General tab. Interestingly, that gave me an error in the first place (prompting me to come here looking for help)...but I'm gonna try again (by first renaming the page field so that it's not identical to the record name; presumably that's what was causing the error...)

Guest's picture
Guest (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Did you ever get the hide column to work? I'm having the same problem with the error message, but renaming the page field didn't get rid of the error.

JF's picture
JF (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

Here is a working example where the page name is "HRS_INT_SCHED", the grid name is also "HRS_INT_SCHED", and the PAGE FIELD name is "AVAILABILITY":
GetGrid(Page.HRS_INT_SCHED, "HRS_INT_SCHED").GetColumn("AVAILABILITY").Visible = False;

Another example, where the page name is "HRS_INT_SCHED" but the grid name is also "HRS_INT_VENUE", and the PAGE FIELD name is "AVAILABILITY_2" (I added 2 to the page field name to make it unique from the other):
GetGrid(Page.HRS_INT_SCHED, "HRS_INT_VENUE").GetColumn("AVAILABILITY_2").Visible = False;

The key is in knowing where to go for the PAGE FIELD name: It's under the "Order" tab (not the "Layout" tab) in app designer.

Hope this helps.

lakema's picture
lakema (not verified)
Re: Hide a Grid Column From a Grid in PeopleCode

You can use the DataAreaCollapse property of whatever rowset the grid is in (the actual DB table of the grid).

Guest's picture
Guest
Hide a Grid Column in level 2 From a Grid in PeopleCode

Hi,
I have a scroll on level 1 and a grid inside it which is on level 2. I need to make the columns of the grid display only. How should i do that ?

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
15 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.