Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, February 22, 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: Issues Calculating Total
Paul Newman
Posts: 2
 
Issues Calculating TotalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 13 9:22 AM

Hi,


 


I am developing on SLX V7.2 LAN and I am trying something I presumed was going to be pretty straight forward but have become stuck.


 


Basically I have to text boxes linked to 2 float fields, I have a third text box in which I would like to display the total amount of the first two combined.


 


Initially I used the Calculated fields process from the Manage menu. I found this way worked ok but sometimes one field is null, in which case I only wish to display the value of the other, also I wish to implement a similar calculation on other fields which are currently Varchar(32). I also tried setting the text box format to 'ftInteger' and using the code as below, this only concatinated the values though.


        txtTotalUpliftNew.Text = txtCPUplift.text + txtBrokerUplift.Text


 


I then created a sub routine to update the relevant fields on change, this method worked ok again but the fields are only updated when I press OK to close the form and I would like the result immediately.


 


I have attempted to using the CDbl as below, I also changed the format type to 'ftFixed' and format string to '%.2f' on the text boxes.  This method appears to work exactly how I want it to apart from the fact I get the 'Type mismatch' error.


        strCPUplifttxt = CDbl(txtCPUplift.Text)
        strBrokerUplifttxt = CDbl(txtBrokerUplift.Text)
        txtTotalUpliftNew.Text = (strCPUplifttxt + strBrokerUplifttxt)


 


Ideally I would like to use the Val function and do the calculation based on the values of the fields but SLX does not appear to recognise Val and I get an error saying that  'Val is undefined'.


 


If anybody has any advise it would be greatly appreciated.


 


Thanks


Paul

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Issues Calculating TotalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 13 10:06 AM

On the WhenExit of the object do this:


If txtCPUplift.Text = "" Then txtCPUplift.Text = 0
If txtBrokerUplift.Text = "" Then txtBrokerUplift.Text = 0


txtTotalUpliftNew.Text = cdbl(txtCPUplift.Text) + CDbl(txtBrokerUplift.Text)


In essence, you want to guarantee there is something to add up - and, to avoid implicit conversion, make sure they are numeric to begin with.


"Val" is not a function of vbScript, nor related to SLX.


 

[Reply][Quote]
Leigh Devine
Posts: 4
 
Re: Issues Calculating TotalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 13 10:27 AM

Thats great, thanks very much for the help Mike.

[Reply][Quote]
Paul Newman
Posts: 2
 
Re: Issues Calculating TotalYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Nov 13 8:36 AM

Yea thanks Mike, glad it helped you too Leigh.

[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): 2/22/2025 9:19:22 AM