Josh Bridgens Posted August 23, 2018 Posted August 23, 2018 Hi Guys, strange one - Is there any way to add the sum of different custom fields? I have been asked to rewrite our purchasing process within SM, I wondered if there was a way to take custom field Numerical data and total the sum of a few? Any ideas would be appreciated. Josh
Jeremy Posted August 23, 2018 Posted August 23, 2018 Hi @Josh Bridgens Yes this is possible and it is something that we have done quite successfully, below is an example of what we have done, which takes information submitted in a PCF and performs a calculation and then you can output to where you want, we output into the timeline so that it is searchable: Total Line Cost (inc VAT) - £&[([functions.pcf("Order2","field_6")]*[functions.pcf("Order2","field_4")]*1.20).toFixed(2)] Other things can be achieved as this is based on javascript. 1 1
Victor Posted August 23, 2018 Posted August 23, 2018 @Jeremy to the rescue ! ... I'll nominate you to be designated as the official Hornbill Mathematician!! 1
Jeremy Posted August 23, 2018 Posted August 23, 2018 @Victor We have done a LOT of these and they can get very complicated very quickly! 1
Victor Posted August 23, 2018 Posted August 23, 2018 @Jeremy - I am not worried as long as you are within reach to help us with these!
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 @Jeremy Fantastic!!!!! I wasn't sure how I was going to do this one. Just so I'm correct in my head.... That all seems fairly standard however I'm unsure regarding the "Order 2" what does this determine? Thank you so much for the help!!!!!! - one more, would I be able to publish this on the PCF......?? so users can see the total cost BEFORE the call is logged? Josh
Victor Posted August 23, 2018 Posted August 23, 2018 10 minutes ago, Josh Bridgens said: would I be able to publish this on the PCF......?? The above advice applies to business process workflows, not progressive captures flows...
Jeremy Posted August 23, 2018 Posted August 23, 2018 Quote the "Order 2" This relates to the question in the PCF that it is pulling from to perform the calculation. I don't believe that you can do this as part of the PCF. I cannot find anywhere you can choose/reference fields within a PCF so this would have to performed as one of the first parts of the BPM. At least this is how we have done this.
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 4 minutes ago, Victor said: The above advice applies to business process workflows, not progressive captures flows... Thought so, but we can all dream cant we?! 7 minutes ago, Jeremy said: This relates to the question in the PCF that it is pulling from to perform the calculation Brilliant... One more question, sorry! In the "value/Display" field within the PCF, If I was to put the value as 30 and the Display as "Wireless keyboard" - would that then pick up the £30 within the equation? Apologies for the million questions. Josh
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens when using &[([functions.pcf("...")] variables, they should pick up values, not the display (it actually picks up the answer which should be the value)... so yes, it should pick up the 30 you have configured there... do a test, let us know how it works (I haven't tried this personally so cannot say for sure... there is a chance I am wrong and the answer stored the display, not the value...)
Jeremy Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens I believe that this should work if it does not then come back as there are other ways around this like hidden fields etc within the PCF
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 1 hour ago, Josh Bridgens said: This relates to the question in the PCF that it is pulling from to perform the calculation OK, Ive tried a few times replacing yours with what I believe mine would be for a test and I'm not doing so well. Total Line Cost (ex VAT) - £&[([functions.pcf("frm_individualassets","fld_laptop1")]+[functions.pcf("frm_individualassets","fld_printer1")]*1.00).toFixed(2)] Am I getting this all wrong? this is getting quite embarrassing now.... Josh
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens so what exactly is not working then?
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 I’m not sure, I put together a bpm that just does the Naths and that’s it, but it fails on the Mathematics, I’m trying to get it to update the h_custom_o field, could that be the issue? I will try and have it just append the description instead.....
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 (edited) Wasn't that.... It picks up the "Display" not the value just as I feared Edited August 23, 2018 by Josh Bridgens screenshot
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens - yeah...not good... I have asked dev team to look into this... from my understanding, it was intended to store the display instead of value ( @Dan Munns FYI) but it makes more sense to store the value actually...
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 If I change the "Display" to 500 and 100 on the 2 items it gives me this: I imagine this will be a much larger fix as people have probably got entire BPM's running it off the display now >.< I am not having much luck today.
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 OK, now this is getting ridiculously strange.... Changed the Simple list I am using to have "50,000" as the one price... Still get £6.00...... Can I go home now?
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens well... you see, Hornbill is a very intelligent system... true, you did set up the 50000 as one price and other values... but Hornbill sees through all this and tell you that the items there...they not worth more than 6 quid... Jokes aside, try this: £&[([functions.pcf("frm_individualassets","fld_laptop1")]*1.00+[functions.pcf("frm_individualassets","fld_printer1")]*1.00).toFixed(2)]
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 @Victor That works! BUTTTTTTTT, Still not past the problem with the whole value/display thing How do you have it @Jeremy? I cant see a way round this one
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 Erm.... Has Hornbill changed something????? My decision nodes are broken as all hell, and now this: None of it works.... :S
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens : new update: "Workflow - BPM Editor: decision node custom expressions now use popup editor" and "Workflow - BPM Editor: change decision node custom expressions to use popup editor so can do more complicated expression by adding brackets" Your decision nodes should not be affected... @NeilWJ any thoughts regarding the PCF variables?
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 6 minutes ago, Victor said: Your decision nodes should not be affected... @NeilWJ any thoughts regarding the PCF variables? Got it now.... today is not my day, formatting was slightly off for the PCF Variables. 30 minutes til home time... 29 minutes til home time... 28 and a half minutes til home time...
Victor Posted August 23, 2018 Posted August 23, 2018 @Josh Bridgens - I'm typing this while you're on your way home: So, do I take it you sorted them now? Wait... wait... do you mean... you're allowed to go home ???
Josh Bridgens Posted August 23, 2018 Author Posted August 23, 2018 2 minutes ago, Victor said: Wait... wait... do you mean... you're allowed to go home ??? Still haven't left the office..... had to pick up the phones!!!!!! I'm half sorted, I'm still a bit, how do i put it, bewildered regarding this display/value dilemma and the way it currently works, It doesn't make much sense to me having it this way. There are certain ways I need to do this so that it maps properly to an agreed "form" for finance to sign off on, and without it displaying the correct names of items, I'm not going to have much luck I will eventually leave this god forsaken place...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now