Re-use a dv.js file

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Re-use a dv.js file

Post by kbarrett » 2019-03-18 18:22

Hello,

I am new to both this forum and a lot of coding. I am working on building a risk management type of application that will have several similar tables. These tables each will have fields that will calculate risk (field1+field2+field3=field4) then when controls are implemented to alleviate risk (field5+field6+field7=field 10) then a subtotal running at the bottom of the page. Very similar to the orders-dv lesson on Udemy. My question is, instead of having to edit several different files, e.g., table1-dv.js, table2-dv.js, table3-dv.js, etc, can I have one dv-js file that all these tables can access to perform the calculation? I perceive depending on the client having many tables, more than 20 for sure. Thanks in advance.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Re-use a dv.js file

Post by jsetzer » 2019-03-18 19:24

As far as I have understood your question you are planning a non-normalized database model. From my experience you definately should avoid this.

You do not need so many tables:
  • If there is one database per client, you only need a Risks-Table and a Evaluations-Table in which each Evaluation is related to a single Risk.
  • If there are multiple clients per database, you will need a Clients-table, a Risks-Table and a Evaluations-Table in which each Evaluation is related to a Risk AND a Client.
Having all ratings (evaluations) in one table makes it extremely easy to calculate averages, to filter, to sort by impact or sort by likelyhood.

Additionally I would create a Likelihoods lookup-table and a Impacts lookup-table, so in every evaluation you will be able to select the likelihood and the possible impact from a dropdown. Your can even have colors (traffic-lighting) and/or icons for both dropdowns. Users of Risk-Management tools are used to it.

And I would add at least a Categories-table (or Organizational Units-table) to group the risks.

With this kind of "normalized" model you can easily add Measures (Tasks), Notes, Evidence (e.g. PDF-documents), History and much more later on.

I hope this helps!

Regards,
Jan

PS: This is an example of a dropdown having colored and css-styled content with icons:
chrome_2019-03-18_20-17-59.png
chrome_2019-03-18_20-17-59.png (67.89 KiB) Viewed 1947 times
https://forums.appgini.com/phpbb/viewto ... down#p9284

You can also show probabilities and impacts in red, yellow, green for example.

PPS: You can see some of my AppGini projects and UI-enhancements here:
https://www.bizzworxx.de/en/appgini-improvements/
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Re: Re-use a dv.js file

Post by kbarrett » 2019-03-18 21:33

Hi Jan,

Thanks for the info. I guess I should be more specific. The project would be copied, renamed and re-used in different areas/servers, so one DB per client organization. It is a hybrid of both risk management and health and safety management. So the part I am interested in is to create a job hazard analysis process where the job is broken down into tasks and then evaluated for risk and reevaluated once controls are established. Each unique position, e.g. carpenter, would require it's own analysis but each position would use the same process. Am I making sense? I can make a bloated project with a table-dv.js etc for each but I am looking to avoid that.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Re-use a dv.js file

Post by pbottcher » 2019-03-19 18:29

Hi,

maybe you can use the hooks/footer-extras.php to implement your js. You can check in which DV you are and act acordingly.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Re: Re-use a dv.js file

Post by kbarrett » 2019-03-19 20:02

Thanks, I decided to use a single table for the process but am now having issues with narrowing the view. I have it somewhat narrowed by department (Groups in the Admin section) but need to narrow it further. I have posted something in the advanced section, Hooks as I think I will need to write a hook, well the correct one as the several attempts I have made haven't worked.

Post Reply