wildmanmatt
New member
Hi,
I am trying to calculate a field and then custom format it based on a date field expiry date...
I have added the following to calculated_fields_functions.php
function dadabik_get_status ($params){
// first, check if price and tax are not empty and not null
if (strtotime($params['expiry_date']) > time()) {
return 'VALID';
}
else{
return 'EXPIRED';
}
}
and the following to custom_formatting_functions.php (which I have taken from the demo application)
function dadabik_format_status($value){
if ($value === 'VALID'){
return '<img src="images/red.png">';
}
return '<img src="images/green.png">';
}
However, I think I am going to have to bulk query / edit the records in my database to populate this field (or go into each record and save each one before anything will show there)?
I also think that this field isn't going to change to red when the expiry date has passed without me going in and editing a record?
Is there any other way around this where the field will change dynamically based on the expiry date without having to edit the record first?
Thanks,
Matt
I'm not sure what I'm doing wrong
I am trying to calculate a field and then custom format it based on a date field expiry date...
I have added the following to calculated_fields_functions.php
function dadabik_get_status ($params){
// first, check if price and tax are not empty and not null
if (strtotime($params['expiry_date']) > time()) {
return 'VALID';
}
else{
return 'EXPIRED';
}
}
and the following to custom_formatting_functions.php (which I have taken from the demo application)
function dadabik_format_status($value){
if ($value === 'VALID'){
return '<img src="images/red.png">';
}
return '<img src="images/green.png">';
}
However, I think I am going to have to bulk query / edit the records in my database to populate this field (or go into each record and save each one before anything will show there)?
I also think that this field isn't going to change to red when the expiry date has passed without me going in and editing a record?
Is there any other way around this where the field will change dynamically based on the expiry date without having to edit the record first?
Thanks,
Matt
I'm not sure what I'm doing wrong