Expand my Community achievements bar.

Calculating a partno from dropdown lists

Avatar

Level 1

Hi team,

I'm building a partno calculator form which has to interpret fields from a row of dropdown entries to come up with the approriate PartNo.

The fields are as in the row immediately below.


PipeType  |  Upstand |  Soffit | Cladding | StudHeight|

Options for each field is as below

80mm Round |    65 |  600 |   70 Brick|  2400 |
110x50 Sq |    85 |  450 |   90 Brick|  2700 |
Universal |   110 |  750 |   Linea |

I understand I need a calculated field  to concatenate elements from the field data selected.

eg.
Say I filled the form fields with the following data
80mm Round |    110 |  450 |   90 Brick|  2700 |

Then the concatenated data will look like

DP 80 110 450 90 2700   or strung together DP80110450902700

I can see I need to use a Calculation scripts; but I am not sure of how to write the script to return the 70/90/ other value for Cladding type into a result field using an IfThenElse format; and in particular the form of the calculation to concatenate string text fields to numeric value fields.

Any help would be appreciated

Cheers

Bernard

2 Replies

Avatar

Level 10

Hi,

I made an example for you.

It uses drop down lists with bound items.

By this method the drop down list can return different values from the values which are displayed.

So if the drop down element "80mm Round" has the bound Item value "80", the returned value is "80" instead of "80mm Round".

The script to concatenate the values into an part number than only takes one single line of code (FormCalc).

$ = Replace(Concat("DP", Row.PipeType.rawValue, Row.Upstand.rawValue, Row.Soffit.rawValue, Row.Cladding.rawValue, Row.StudHeight.rawValue), "XX", "")

https://acrobat.com/#d=yVDbq4sLYE7oKo-b7HZmiA

Avatar

Level 1

Hi Radzmar,

That is an excellent representation of what I need to do. However I need to be able to incorporate calculated values depending on the item selected in each field. 

PipeType: if(pipetype = "110x50 Sq","DPS","DP")  // using excel 'if then else' format

Upstand = 110

Soffit =  if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "70")) {event.value = "470";}

else if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "90")) {event.value = "450";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "70")) {event.value = "320";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "90")) {event.value = "300";}

else if ((this.getField("cSoffit").value == "750") && (this.getField("cCladding").value == "70")) {event.value = "620";}

else if ((this.getField("cSoffit").value == "750") && (this.getField("cCladding").value == "90")) {event.value = "600";}

else if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "35")) {event.value = "525";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "35")) {event.value = "375";}

else if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "60")) {event.value = "500";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "60")) {event.value = "350";}

else if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "35")) {event.value = "545";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "35")) {event.value = "395";}

else if ((this.getField("cSoffit").value == "600") && (this.getField("cCladding").value == "50")) {event.value = "530";}

else if ((this.getField("cSoffit").value == "450") && (this.getField("cCladding").value == "50")) {event.value = "360";}

else {event.value = "no cladding match";}    // I used this in Acrobat Pro X forms.

Cladding =  if Cladding is Brick 70mm then B7

else if Cladding is Linea then LL

else if Cladding is Celcrete then CC

else if Cladding is Smooth Weatherboard then SW

else if Cladding is Poly with Plaster then PP

else XX

Studheight = if studheight is 2400 then 2500 else 2800

My question then is how do I get these conditional values into the form?

In addition to this, I need to add 2 more rows to the table.

Many thanks

Bernard