Solved

Pulling and updating data from DB

Posted on 2013-06-11
4
432 Views
Last Modified: 2013-06-26
Hello Drupal Experts,

How can I use data in content types from another content type and have that data updated?  I have one content type that I would enter a float ($1,000.00).

I would like for other content types to get that float value and then perform calculations within an other content type. Once saved, the ($1,000) is changed and can be used elsewhere...if needed.

Content Type: Enter Money
Float textfield: (moneyEntered=$1000)

Content Type :  Adjust Money
Float textfield:  (from moneyEntered)
Float textfield:  (moneyAdjusted=$500)

So now the moneyEntered value=$1500 and it can be used in other content types as needed.

Thank for any help.
0
Comment
Question by:Modifier1000
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:oliverpolden
ID: 39238377
Hmmm, strange stuff you're doing there.

I don't think I can solve that for you but the computed field module may be of use:
https://drupal.org/project/computed_field

Also, I'm not sure of your end goal but maybe a more real time calculation would be a better idea, i.e. take the same fields from each node and do a calculation on them using the views calc module:
https://drupal.org/project/views_calc

Perhaps a single node for all this and the field_permissions module?
https://drupal.org/project/field_permissions

If you let me know your higher level goal, maybe I can suggest a better approach.

Oliver
0
 

Author Comment

by:Modifier1000
ID: 39238513
Thank you, maybe my diagram will help better explain.
Process-of-pulling-data.png
0
 
LVL 10

Accepted Solution

by:
oliverpolden earned 500 total points
ID: 39238785
That doesn't describe what you are trying to achieve. That describes a possible solution.

Why do you have separate content types for account adjustments and account balance and why do you need to update different nodes?

Have you come across the views module? It's very versatile and allows you view and manipulate multiple nodes in different ways:
https://drupal.org/project/views

If however that is what you really need to do then you will probably need to create your own module to act on nodes when they are saved and updated.

Here's some info about how to react to node actions:
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_presave/7
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_submit/7
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_update/7

Oliver
0
 

Author Closing Comment

by:Modifier1000
ID: 39279460
Thank you!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I upload sample data in drupal on godaddy? 1 102
Configuration Menu in Joomla 7 144
Create Sample Internet Traffic 1 93
WordPress Page with Embedded Gravity Form 22 37
Drupal 5.x currently does not have a production-ready patch bundle to allow for split read & writes for a MySQL master/slave replication setup. After reading a open discussion/thread on the Drupal site (http://drupal.org/node/147160 (http://drupal.o…
This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question