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] Read/Write numeric column values.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Read/Write numeric column values.
 Login/Join
 
Guru
posted
Hi all,
I have Read/Write grid in which there are numeric columns with datatype D20.2 When I am entering a long value like 01234567890123456789 it gets converted into ********************** and it is getting updated as 0 in database table.Is there any way to restrict user from entering values which are not consistent with the datatype of the column associated with Grid.

Thanks in advance.

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


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 2007Report This Post
Expert
posted Hide Post
From memory, I thought you could attach a js function to validate the input.

I'm sure the Wizard will let you know.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Can anybody help me with sample script to handle this?

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 2007Report This Post
Master
posted Hide Post
According to the documentation D formats will store and display the 15 most signifcant digits. P format will go to 31 significant digits. I format will go to 10 digits and F format is something like 7 significant digits.

You should be able to find this in the Describing Data manual for your release.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Master
posted Hide Post
You can use this technique to create a mask to limit the number of characters entered into the Active-X Grid in Maintain. You want to set up the mask when the user clicks or tabs into the cell.

Setting limit using QuickSetMask Function prevents invalid entries, overflows, or truncations. Recommended use for OnCellChange and OnLClicked Events.

// OnCellChange Event (if TAB or ENTER to next cell)
Form1.Grid1.UseMaskedEdit(1); // enable mask editing
Form1.Grid1.QuickSetMask (newCol, newRow, "CCCC");

// OnLClicked Event (if left mouse clicking to next cell)
Form1.Grid1.UseMaskedEdit(1); // enable mask editing
Form1.Grid1.QuickSetMask (col, row, " CCCC");

Where:
0 - Digit (0 through 9), entry required; plus and minus signs not allowed.
9 - Digit or space (entry optional; plus and minus signs not allowed)
A - Letter or Digit (Entry required) a - Letter or Digit (Entry optional)
L - Letter (A through Z, entry required) ? - Letter (A through Z, entry optional)
C - Any character or a space (Entry optional)
& - Any character or a space (Entry required)

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Guru
posted Hide Post
Hi,
I have a field in table column with datatype NUMBER(8,4) . Suppose user want to enter value 111.11 and I have used Form1.Grid1.QuickSetMask (12, row, "CCCC.CCCC"); to restrict user.Now when user tries to enter the value it will be taken as 111..11 which is not proper and the time of updation,it is updated as 111.0000 in database table.So,I want that when user enters ' .' before '.' in QuickSetMask function, it should not allow anymore '.' and restricts user to enter only 4 digits after decimal point.How to handle this? Please help.

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 2007Report This Post
Master
posted Hide Post
The only thing that the Mask function can do here is limit the number of characters. If you use:

function OnGrid1_OnCellChange ( int col, long row, int newCol, long newRow) {
Form1.Grid1.UseMaskedEdit(1); // enable mask editing
Form1.Grid1.QuickSetMask (newCol, newRow, "CCCCCCCC");
}

function OnGrid1_OnLClicked ( int col, long row, boolean updn, boolean processed) {
Form1.Grid1.UseMaskedEdit(1); // enable mask editing
Form1.Grid1.QuickSetMask (newCol, newRow, "CCCCCCCC");
}

You limit the input to 8. Do not use a decimal in the mask. Let the user enter that themselves. You can then check the value of the input either using JavaScript here, or in the Maintain to determine if the value is incorrect before updating the database.

You can use the OnCellChanged event to get the value and make sure it is not greater than 999.9999.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Virtuoso
posted Hide Post
The simplest way to achieve this type of validation in JavaScript is to use regular expressions. Use an onchange event on the field and check against a reg ex:
<html>
  <head>
    <title>Check Reg Exp</title>
    <script>
    function checkNumber() {
      var regexp=/(?!^0*$)(?!^0*\.0*$)^\d{1,10}(\.\d{1,4})?$/; 
//                 numerics and decimal point     
//                                          10 before decimal point, change to requirement
//                                               . 1 decimal point
//                                                     4 after decimal point, change to requirement 
      if (document.getElementById("number").value.search(regexp)==-1) 
      alert("Please enter a valid number inside form")
    }
    </script>
  </head>
  <body>
    <input type="text" name="number" id="number" onchange="checkNumber()">
  </body>
</html>


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Hi Mark,
When iam trying to capture value entered by user by using below piece of code it is giving me previous value present in the cell.

 
function OnGrid1_OnCellChanged ( long col, long row, string text)  {
var c1 = evest_hold.Grid1.GetCurrentColumn;
var r1 = evest_hold.Grid1.GetCurrentRow;
evest_hold.Grid1.GetCell(c1,r1);
var StrCellGet = evest_hold.Grid1.CellGetText;
alert (StrCellGet);
}


e.g suppose there is value 1 present in a cell and user is trying to change it to 2, the CellGetText function returns 1 which is not required.I need to capture the value 2 and determine whether it is not greater than 999.9999 before updating database.How can I capture the new value inserted?

Thanks.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 2007Report This Post
Master
posted Hide Post
Try OnEditFinish. It passes the text in for you:

function OnGrid2_OnEditFinish ( int col, long row, string text, boolean cancelFlag) {
alert(text);
}
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Guru
posted Hide Post
Thanks everyone for help.It worked.

Regards.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 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] Read/Write numeric column values.

Copyright © 1996-2020 Information Builders