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     [SOLVED] JAVA Compare of Grid Cell Values Drop Zeros on Right Side of Numbers

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] JAVA Compare of Grid Cell Values Drop Zeros on Right Side of Numbers
 Login/Join
 
Gold member
posted
I am comparing two cells in a grid to check that the number in col 12 is not larger than the number in col 9. But if the number in col 9 is 300, it compares as the number 3 with the 00 dropped. Both fields are defined as I5. The number in col 12 does not drop the 00s on the right. My code follows:

function OnGrid1_OnCellChange ( int col, long row, int newCol, long newRow) {
if (col == 12)
{
Full_Inventory.Grid1.GetCell(12,row);
var Delv_No = Full_Inventory.Grid1.CellGetText();
Full_Inventory.Grid1.GetCell(9,row);
var Quant_Avail = Full_Inventory.Grid1.CellGetText();
if (Delv_No > Quant_Avail)
{
Full_Inventory.Grid1.GetCell(12,row);
Full_Inventory.Grid1.CellSetText(" 0");
Full_Inventory.Grid1.SetCell(12,row);
Full_Inventory.Grid1.RedrawCell(12,row);
alert("Quantity to deliver is greater than quantity available.");
}}}

Thanks, Kent

This message has been edited. Last edited by: Kerry,


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
 
Posts: 63 | Location: Ft. Wayne, IN | Registered: February 20, 2007Report This Post
Master
posted Hide Post
Kent
Could you alert both Delv_No and Quant_Avail before the comparison? When I use your code, I am getting the previous value for Delv_No and not the changed value. If you alert Quant_Avail are you seeing 300 or 3?

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Gold member
posted Hide Post
Mark,
Both Delv_No and Quant_Avail alert with the proper numbers before the comparison. Quant_Avail alerts as 300 but compares as 3.
Strange, huh.
Kent


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
 
Posts: 63 | Location: Ft. Wayne, IN | Registered: February 20, 2007Report This Post
Master
posted Hide Post
Kent - Could you try a quick test for me? Instead of using OnCellChange, use OnEditFinish. This will have the text of the Quant_Avail passed to it with the text parameter. See if this makes a difference.

Also, open up the form and the grid in the MDE. Click on the column and check the Width in characters for the Quant_Avail field. Make sure it is greater than 3. Then, the only other thing I can think of is, is there another Quant_Avail field somewhere on the form? Could the code be getting confused? Add a 'Z' or something to the name to make it unique.

function OnGrid1_OnEditFinish ( int col, long row, string text, boolean cancelFlag) {
if (col == 12)
{
var Delv_No = text;
alert(Delv_No);
Full_Inventory.Grid1.GetCell(9,row);
var Quant_Avail = Full_Inventory.Grid1.CellGetText();
alert(Quant_Avail);
if (Delv_No > Quant_Avail)
{
alert("Bad");
}
}
}


Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Master
posted Hide Post
Kent - Please hold off testing my suggestion. I am able to repro the issue and am looking for a solution.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Master
posted Hide Post
Kent -
I am not sure if this is the only solution, but you can use the parseFloat function so JavaScript sees the input value as a number, and not a text value. I have added it to your code and it should work now. I STILL would consider using the OnEditFinish trigger instead of OnCellChange.

Mark

function OnGrid1_OnCellChange ( int col, long row, int newCol, long newRow) {
if (col == 12)
{
Full_Inventory.Grid1.GetCell(12,row);
var Delv_No = parseFloat(Full_Inventory.Grid1.CellGetText());
Full_Inventory.Grid1.GetCell(9,row);
var Quant_Avail = parseFloat(Full_Inventory.Grid1.CellGetText());
if (Delv_No > Quant_Avail)
{
Full_Inventory.Grid1.GetCell(12,row);
Full_Inventory.Grid1.CellSetText(" 0");
Full_Inventory.Grid1.SetCell(12,row);
Full_Inventory.Grid1.RedrawCell(12,row);
alert("Quantity to deliver is greater than quantity available.");
}}}
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Gold member
posted Hide Post
Thanks, Mark.
Adding parseINT made it work.
I can not get OnEditFinish to give me what I need so I left it as OnCellChange.

Kent


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
 
Posts: 63 | Location: Ft. Wayne, IN | Registered: February 20, 2007Report 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     [SOLVED] JAVA Compare of Grid Cell Values Drop Zeros on Right Side of Numbers

Copyright © 1996-2020 Information Builders