Table view to show Price text from price number

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
tminh
Posts: 28
Joined: 2019-05-23 02:26

Table view to show Price text from price number

Post by tminh » 2019-05-28 05:09

My real estate table is : bds

Price filed is : bds_price `bds`.`bds_price`

I want to convert price number to price text, eg: 1,8 billion

I eidt hook but it does not work, please help, thanks:

function bds_init(&$options, $memberInfo, &$args){
// minhx https://bigprof.com/appgini/tips-and-tu ... sing-hooks
$old_options = $options->QueryFieldsTV;
foreach($old_options as $field => $caption){
/* Keep all fields as-is except for the phone field */
if($field == '`bds`.`bds_price`'){
/* Display only the first four digits of the phone field */
echo 'dasdasdasd';
$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = '9999999999';
}else{
/* Keep all other fields as-is */
$new_options[$field] = $caption;
}

$options->QueryFieldsTV = $new_options;
}



return TRUE;
}

tminh
Posts: 28
Joined: 2019-05-23 02:26

Re: Table view to show Price text from price number

Post by tminh » 2019-05-28 05:33

$new_options["`bds`.`bds_price`"] = $caption;

i echo $caption but it show only 'bds_price' not its value'

how do i show its value

thanks

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

Re: Table view to show Price text from price number

Post by pbottcher » 2019-05-30 08:37

Hi,

you need to put the field to which you apply the change of the sqlquery.

$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = '9999999999';

$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = $caption;
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.

Post Reply