Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Maintain Grid Control functionality questions

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Maintain Grid Control functionality questions
 Login/Join
 
Silver Member
posted
I’m just starting to work with the maintain grid control and was wondering if you could accomplish a couple of different tasks with the control.

We would like to bring up a set of data in a grid and allow the user to be able to change one value in row/column and then be able to copy and paste this change to all other rows in the grid. We are trying to make it easy for the user to change multiple values in a grid, similar to what you can do in Excel .

We would like to bring up a set of data and change individual fields in the grid and then when the user hits the update button, update the modified fields and update an audit field in the table with the datetime of the change, but only for those rows in the grid that have data that has been modified. I know you can easily update all rows in the grid by using “For All Update…”. What I’m not sure about is if you can loop through the stack and determine if a row has been changed and then update a field if something in the row has been changed.

Thanks,
Ron
 
Posts: 38 | Location: Milwaukee | Registered: April 28, 2005Report This Post
Virtuoso
posted Hide Post
Ron

The ability to copy and paste is limited to a single cell as far as I can remember.

To compare values you can have 2 stacks, one stack from the retrieval and then copy this for display, then compare the 2 stacks, field by field.

Otherwise create a new field in the stack and create a new control on the page with just this field in it, and hide it, use an onchange event on each field in the main control to update this field to a value in the row changed, that can be picked up when processing the page.

Hope that makes sense!


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Ron,

If you manually paste data to all other rows, you have to do one at a time, by double clicking on the cell and paste it as mentioned by Alan. You can place a button on the form to apply your changes in one row to all other rows by clicking button, which you have event handler coded.

To answer your 2nd question, you make a copy of original stack, put your updated data in a different stack, then do value comparison. Another way is you may set up an array (just a flag) to record focindex in stack which the value has been changed. Then you compare the stack.focindex with the value in that array, if the values match, then you know the value changed.
 
Posts: 118 | Location: Omaha, NE | Registered: June 12, 2003Report This Post
Master
posted Hide Post
Ron
There is quite a bit you can do with the grid. You can use either Maintain code or JavaScript code to do this. It's helpful to use JavaScript as the form does not have to reload everytime. However, in order to change rows and columns, you will have to use Maintain.

If the user changes a row, you can use the following code to set an Update flag in the grid:

function OnGrid1_OnCellChanged ( long col, long row, string text) {
if (col !=3)
{
Form1.Grid1.GetCell(3,row);
Form1.Grid1.CellSetText("Y");
Form1.Grid1.SetCell(3,row);
Form1.Grid1.RedrawCell(3,row);
}
}

This says, when a cell is changed, as long as it's not column 3 (That's my flag column) put a Y in the flag column. Now, when the user presses update, you can copy the updated rows to a new stack to copy:

For all copy from DisplayStk into UpdateStk
Where UpdateFlag = 'Y'
For all Update fields from UpdateStk

As for copying the changes to the other rows, that's pretty straight forward. Say the user changes the value of Field2 in row 1, and you want to apply that change to every row in the grid. You would just use the following code when the user presses the Process button:

Compute i/i2=2; -* Start at row 2 since the new data is in row 1
Repeat STK.foccount -* Substitute the name of your stack here
Compute stk(i).field2 = stk(1).field2;
Compute i=i+1;
endrepeat

Now, when the form redisplays, the value in field2 for all of the rows is the same as the entered value in row 1. This could probably be done in JavaScript as well.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Silver Member
posted Hide Post
Thanks for all of the ideas. I think these will give me a good start.

Ron
 
Posts: 38 | Location: Milwaukee | Registered: April 28, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Maintain Grid Control functionality questions

Copyright © 1996-2020 Information Builders