Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, July 7, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Text control display issue with Number: Input is 7.2 but output is 7.20000000009
K. Rajapandian
Posts: 11
 
Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Aug 10 7:20 AM
I am importing few number values from Excel to SLX using SLX Button control.
For example, Please see the below sample values

Column 1

2.3.1
7.3.4
7.2
5.4.5
5.6

i am importing the above 5 values to 5 accounts. But the output is like this

2.3.1
7.3.4
7.20000000009
5.4.5
5.60000000009

I have tried with Format type and Format String. But i didnt get any solution.
Please help me on this.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Aug 10 8:47 AM
???
THIS IS NOT A NUMBER: 2.3.1
THIS IS NOT A NUMBER: 7.3.4
7.2
THIS IS NOT A NUMBER: 5.4.5
5.6

You are complaining that 7.2 and 5.6 are not being imported incorrectly, yet these are the only valic numbers in your supplied sample dataset

What is the script code that you are using to read in these values?


what sort of field are you storing them in in the SQL Server database?
[Reply][Quote]
K. Rajapandian
Posts: 11
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Aug 10 9:10 AM
Hi Samp,

I am storing the value in SQL as String only. Because sometime it will be "1.2A" also.

The following steps, i am inserting the value into SLX DB.

1. i m just creating ("ADODB.Connection") object,
2. Through this object i am using "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=testexcel.xls;Extended Properties=Excel 8.0;" provider.
3. executing and setting the result to "testObj"
4. Through loop extracting the value and assing to "Testvar"
5. Creating slxObj for that particular table using SLX API
6. slxobj.AddNew
7. slxobj.Fields("TestField") = "TestVar"
8. slxobj.Update

Please give me your suggestion on this.

Regards
K. Rajapandian.

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Aug 10 10:44 AM
It's obviously a rounding issue caused by the fact that 7.2 is a valid number. What is the data type of 'Testvar'? If you examine the value of testvar before it is inserted, is it correct at that point or not?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Aug 10 10:57 AM
Share with us the code for your step 4...how are you extracting and passing the values from Excel?

cSTR would be a start.
[Reply][Quote]
K. Rajapandian
Posts: 11
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Aug 10 6:07 AM
Dim TestConn, TestRS, TestSLXDB

Set TestSLXDB = New SLX_DB
Set TestConn = CreateObject("ADODB.Connection")

TestConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = TextExcel.xls; Extended Properties = Excel 8.0;"

Set TestRS = TestConn.Execute("select * from [Sheet1$]")

With TestRS
While Not (.EOF Or .BOF)
InsertExcelValue(TestRS.Fields(0).Value)
.MoveNext
Wend
.Close
End With

Sub InsertExcelValue(TestVar)

Dim TestVar, TestObjInsertRS, strSQL

Set TestObjInsertRS = TestSLXDB.GetNewRecordSet
strSQL = "Select TestField from account where 1=2"
TestObjInsertRS.Open strSQL, TestSLXDB.Connection

TestObjInsertRS.AddNew
TestObjInsertRS.Fields("TestField") = TestVar
TestObjInsertRS.Update

TestObjInsertRS.Close
Set TestObjInsertRS = Nothing
End Sub
[Reply][Quote]
K. Rajapandian
Posts: 11
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Aug 10 6:10 AM
Its a variant type variable and i am not examined the variable. I have updated the code. Please see the code and let me know your feedbacks.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Text control display issue with Number: Input is 7.2 but output is 7.20000000009 Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Aug 10 7:52 AM
Excel does its own formatting...you need to put an apostrophe before every item in this column IN the Excel spreadsheet.

7.2.3 is not a number.

7.2 IS definitely a number and Excel will supply the numeric double\real number value to your routine's ADO recordset. If the answer is 7.20000009 then there you go. No Format or cSTR function will save you.

We see this all of the time with US Postal Codes.
53562 is a valid postal code.
06815 is a valid postal code, EXCEL says it's 6,815.

You need to start running Debug Viewer and using Application.Debug.Writeline in your code to see what is going on.

Sure TESTVAR is a variant, (aren't ALL vbscript values, you want to know its sub type!!!), but what is its value? If the answer is 7.20000009 then that's what is going to be stored.....whether it's a number or not.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/7/2025 10:33:44 AM