Jump to content

Add a Column of Numbers


JoyceKeller

Recommended Posts

How do I add my price fields so they populate the Total field?

 

The following returns a string of numbers, not a total.

There are probably other gross conceptual errors with this. :eek: I need help. thanks.

 

if (Field("Total"));

return(Field("PartCost1"))+

(Field("PartCost2"))+(Field("PartCost3"))+

(Field("PartCost4"))+(Field("PartCost5"))+

(Field("PartCost6"))+(Field("PartCost7"))+

(Field("PartCost8"))+(Field("PartCost9"));

Link to comment
Share on other sites

Joyce

 

When you are in the rules editor and you bring up the building blocks area, you will find a tab called "Functions". Under that tab you will find a selection for "Math". In here you will find basic mathematical functions as well as two functions called "Int" and "StringToNumber". These will convert a text field whose contents is composed solely of numbers into a number that can now be used in mathematical equation. The "Int" function will create an integer "whole" number from a text number and the "StringToNumber" function will convert a text number into a "floating point" number (one that can contain a decimal value).

 

Try something like this...

if (Field("Total"))
 return StringToNumber(Field("PartCost1"))+
 StringToNumber(Field("PartCost2"))+StringToNumber(Field("PartCost3"))+
 StringToNumber(Field("PartCost4"))+StringToNumber(Field("PartCost5"))+
 StringToNumber(Field("PartCost6"))+StringToNumber(Field("PartCost7"))+
 StringToNumber(Field("PartCost8"))+StringToNumber(Field("PartCost9")); 

Hope this helps.

 

Good Luck

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...