# If statement in Bluebeam pdf

Hi, I am new to this forum and very new to javascript. We are trying to make an easier process for the company to receive material pricing from our suppliers. At the moment, we receive hand written garbage that is quoted in either price per pound, price per foot, or each.
I am trying to create an easy to use pdf form to eliminate all the extra calculation work. I am currently trying to do this on Bluebeam extreme.
I have an excel file that does EXACTLY what I am looking to do but I dont know how to upload it here.

Basically all I am trying to do is convert different pricing back in a price per piece (EACH PRICE). Simple calculations between cells is no problem, just the “if” code.

The only thing I need help with is coming up with a code that will do this. I am familiar with coding but have never touched javascript and for the simplicity of this code I was hoping somebody could just help me instead of going through hours of learning.

Any help is extremely appreciated!

Thanks
Sandro

Hi im just updating this post to hopefully get some feedback

Could you give me some of your desired input with your desired output? I dont know bluebeam but if you give me something like

``````Input :

[1, 2, 2,3, 13, 1, 11, 2]

Output
1
2
3
11
``````

maybe I could help

If it already does exactly what you need, what’s wrong with just using the Excel form?

@mandaputra8 Thank you so much for the reply. Yes I will try to be very clear, sorry if this becomes wordy…
I want to have three cells. one for “Length”, one for “Weight”, and a “unit price”
The next cell would have a dropdown menu to choose which unit is being used for pricing (per pound, per foot)
the next cell would simply be a total. for example a supplier would type in…

QTY Length(ft) Weight unit price UOM(dropdown) Total
2 20 n/a 3.5 Per foot 3.5 * 20 * 2 = 140

I hope the above formats the way i just typed it lol. If the supplier prices material by weight then they would input the weight, leave the length cell empty, and choose per pound in the drop down.
The only thing i require is the code to go into the Total cell because it would need to read something like this…
If (dropdown) = per pound Then
total = (unit price) x (weight)
Else if (dropdown) = per foot Then
total = (unit price) x (length)
End if

Please let me know if you can help or if you need further clarification. I really appreciate the help!!

@lionel-rowe Thank you for your reply. Unfortunately I can not guarantee that all of the suppliers I will send this form to will have Excel. I want to create a fillable pdf form so anybody can use it.

What about Google Sheets? No software installation required. Or is that not an option for your suppliers?

I ask because you may end up saving yourself a lot of hassle in the long run, compared to hacking something together in a language you’re not familiar with (unless you intend to learn JavaScript properly and are happy to take on the maintenance yourself).

Bear in mind that JS-in-PDF is already quite a niche use case for JavaScript.

Seems like your problem is `Bluebeam` specific I assume, so maybe I couldn’t help.

first, you should able to detect if dropdown value change
second, you should able to take all the value of your column and row,

And if the value is like this `[900, 30, 21]`

you could use this :

``````// 900 is price, 30 length, 21, weight
const arr = [900, 30, 21]

// length
const totalByLength = arr[0] * arr[1]

// weight
const totalByLength = arr[0] * arr[2]
``````

What I mean by input is the value of your column and row, that returned by the Bluebeam, The output is what you want… Just do what I told first, detect if dropdown value change and you can comeback when you got it. Cause I really dont know what is bluebeam extreme

You might be right about bluebeam as this will be my first form to create however I am lead to believe that it should just be similar to however javascript would read information from any other table.

Im not sure I understand the logic in your code. the numbers will always change because that is what the suppliers will be filling in. how do you detect if a dropdown value has changed?

Simple actually here my fiddle hope its help

Yes the number change that is why my second instructions come you should able to take all the value of your column and row, and after that, you could just sum it up

Ok sorry i am having a hard time following you. Maybe this will be easier, I have uploaded a picture of the excel sheet a made.

the “H” column is all the same dropdown list, i have created three lines for the three ways we have material quoted.
How would the javascript code read in line 3 in the total column? in javascript it would need to say
If H3 = “Per foot” Then
I3 = G3 * E3 * A3
Else if H3 = “Per pound” Then
I3 = G3 * F3 * A3
End if

If you could please write that code in Javascipt, I feel like I should be able to manipulate it to what I need. Again, thank you for the help.

Sorry for late reply, how to select H3, I3? I still don’t know how to do that in Bluebeam, this problem actually become specific on how to manipualte bluebeam form data with JavaScript. Are you sure not contact their customer support for this kind of thing?

``````// i dont know where the column come from so...

if(h3 === 'Per Foot'){
i3 = g3 * e3 * a3
} else if (h3 === 'Per Pound') {
i3 = g3 * f3 * a3
}
``````