Adding a Calculated UD field to a customization

I am looking for a little advice on how to add a UD field in the project module that contains a calculation based on values from the project analysis table. What we are trying to add is a field that will contain the total sales values from the project analysis table, but I’m not sure the best way to go about this. I have created a TotalSales_c UD field and have added the a NumericEditor box into the screen and used the EpiBinding to tie this to the new field. We would like this value come from the detail in the Project Analysis Table (Sum TotalSalesValue where LineCode = Revenue and LineSource = Sales Order) and to recalculate whenever the build project analysis is run. I’m not sure if this should be a BPM or code within the customization. I do have a BAQ that could also be used as the source of this info, but don’t know how to tie this all together. Would it be best to do this somehow with code within the customization, or a BPM. If a BPM, any idea what method to use that could be tied to that build process? I’m not a coder, so am hoping someone can point me in the right direction on how to begin this task.

Thanks,
Patti

If you have the field, you can probably do this with a BPM. I would run a trace when you do the build analysis to see where you could set the BPM. Then see if the data that you need is in that set. Not knowing projects very well I don’t have a lot of knowledge of the specific tables, so I don’t have specific suggestions for you as far as BPM’s.

Another option, while not as elegant is to use a UBAQ and update the field when it needs to be, or use a baq in combination with DMT and update it when necessary. But that will depend on if you can live with that lag, or how up to date you need that field. If you are watching that field for an immediate change when you do something, those options will be tedious. If you just need to update them once a week or so, then it’s not so bad and easy to set up.

Another option is more of a coding option, and that is to dynamically run the BAQ to populate the value real time. That’s going to be a lot more code, and nothing will be stored in the database if you are looking to use the value elsewhere.

One more option is to make a dashboard with that BAQ that you made and subscribe to the information on the screen (I’m assuming project number??) and embed the dashboard grid into the screen. It will only be one row and one column, but it would use more of the ICE tools, and less coding.

Are you looking for a total across all projects? Or a total with the project you are looking at? Did you put the UD field on the project header table?

TraceData16076 - Build Project Analysis.txt (122.9 KB)

Attached is my trace log. I’m not sure how to do a BPM on a process.

fist, a general tip to help with tracing, before you start the trace, exit your system agent, it will remove a lot of extra stuff that is irrelevant. (you’ll have to turn it back on if you want to print anything though)

image

I don’t see anything in the trace that looks like it would work either. (I could be wrong though, I’m still learning this stuff too). You could maybe hang it on project update, but I think you’ll have to use some code or at least a BOWidget to populate your data set… Probably not a real clean solution.

If it were me, I would go with the embedded dashboard route, especially since you said you already had a BAQ that get’s you what you need. That’s a customization that can be done with all wizards and little to no coding. It may not look as nice as a single field, but I think it will get you what you need.

If you really have your heart set on a text box, then dynamic query option is what you want. There are some examples in the forum on how to do it. It’s a little code heavy.

1 Like

You should be able to do this in either a customization or BPM in a few different ways.

I think the easiest might be to use customization. Add After Field Changed event for the total field (on the proper dataview - which you can determine using field help)

In the after change code, set that value into your UD field