By czeky on
Hi, I'm using computed field to calculate money exchange between 3 currencies, EUR, US, GPB, user input is value at one of these, then computed field outputs calculated value for the other two, and its working fine, what I want is to have in database all 3 calculations, because of the views money amount filtering based on currency, I was thinking this way..
1. user inputs EUR in money field - working now
2. computed fields do and outputs a conversion - working now
3. converted values from computed fields will be automatically stored (filled in) the money fields - can't figure it how
Many thanx for a help..
Comments
You can try utilising Views
You can try utilising Views Bulk Operations and writing an action for it.
This way all your old entries could be converted/saved and new one's immediatelly by using Trigger.
uff, kinda difficult for me..
uff, kinda difficult for me.. but thanx, does anyone have a small hint?
there is a help in money field..
Advanced usage only: PHP code that returns a default value. Should not include
delimiters. If this field is filled out, the value returned by this code will override any value specified above. Expected format:return array(
0 => array('amount' => value for amount, 'currency' => value for currency),
// You'll usually want to stop here. Provide more values
// if you want your 'default value' to be multi-valued:
1 => array('amount' => value for amount, 'currency' => value for currency),
2 => ...
);
what I need is how to pass the variables from the previous computed field to this one
my way is no go, because
my way is no go, because computed field is calculated on submit and money field needs input before, so I'll try Your suggestion, hop I can google it.. uff, thanx
If you need any help i'll
If you need any help i'll gladly help you :)
Oh that would be nice...
Oh that would be nice... ;-))) thank You
so I managed it this way so far.. not using computed field now
1. user inputs 1 amount and select a currency
2. I put simple php to calculate and display the other amounts of the other currencies into node.tpl.php, in this case, all actual amounts are calculated when viewing the node, which is cool and up to date
3. I'm able to store them directly into database via db_query UPDATE into db tables I created, not drupal/modules tables, which is not good I think
I'm not able to manage how to search these values within views filters, what I need is 1 exposed amount field and 1 exposed dropdown menu - anonymous user inputs amount, select currency from the drop down menu and search/filter and sort nodes based on amount and available currencies
Thanx