How to keep Changings in TableName_View.php file Permanently?

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
mohamed
Veteran Member
Posts: 88
Joined: 2020-04-19 16:18

How to keep Changings in TableName_View.php file Permanently?

Post by mohamed » 2020-10-24 12:59

Hello,

I am able to edit the Internet_view.php file to have both:
- add the currency sign "USD"
- and change the number format to have a Comma (1,000) and Two Decimal Placed

but the problem, such changed get overwritten, whenever I re-generate the project files, i.e., I must configure the above again in the Internet_view.php


$totalPrice = "USD ".number_format[/color]("$row[0]",2,".",",");
$sumRow .= "<td class=\"Internet-Total text-right\">{$totalPrice}</td>";
$sumRow .= '<td class="Internet-Remarks"></td>';
$sumRow .= '</tr>';

$x->HTML = str_replace('<!-- tv data below -->', '', $x->HTML);
$x->HTML = str_replace('<!-- tv data above -->', $sumRow, $x->HTML);


Is there a way to keep these cahnges not to get changed ?
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

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

Re: How to keep Changings in TableName_View.php file Permanently?

Post by jsetzer » 2020-10-24 13:39

Did you see the dataFormat options?

AppGini_WMBGe53671.png
AppGini_WMBGe53671.png (30.86 KiB) Viewed 2658 times

I hope this old thread will help:
viewtopic.php?f=11&t=1614&p=13242&hilit ... mat#p11142
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 25.10 + all AppGini Helper tools

mohamed
Veteran Member
Posts: 88
Joined: 2020-04-19 16:18

Re: How to keep Changings in TableName_View.php file Permanently?

Post by mohamed » 2020-10-24 16:52

Hi jsetzer
Thank you ...

The problem, dataFormat changes the type of the numbers to String, I believe, so it does not let you use the Calculated Field, i.e., you cannot use Calculations nor SUM.
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

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

Re: How to keep Changings in TableName_View.php file Permanently?

Post by jsetzer » 2020-10-24 17:18

I'm afraid you are right. So maybe, instead of changing overwritable files, you should add hooks/TABLENAME-tv.js and (a) use jQuery to change that sum cell and (b) avoid using calculated fields for calculations mixed with string formatting.
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 25.10 + all AppGini Helper tools

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

Re: How to keep Changings in TableName_View.php file Permanently?

Post by jsetzer » 2020-10-24 17:24

What I mean by (b):
Formatted calculated fields will be overwritten in TV row by row and then lose their format unless you turn it into varchar and format the value in sql.

Personally, I dislike mixing (calculated) numbers and string formatting. In these cases I am usually using after... hook or _init hook for updating numeric fields (not calculated fields). Then I can use dataformat options.

I love calculated fields, but they have their limits. That lazy row by row update in table view is one limit I have faced several times in the past. So I'm using calculated fields very carefully and prefer the hooks way very often.
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 25.10 + all AppGini Helper tools

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

Re: How to keep Changings in TableName_View.php file Permanently?

Post by jsetzer » 2020-10-24 17:38

Reading your question again,
(c) you can make that overwritable file read only. It will not be overwritten. But then changes in project will not be applied to those files. So, whenever you do changes in overwritable files, not hooks files, you will have the same problems. That's why I almost never do this.

(d) There are one or two experienced superheroes around here who often do such string replacements in header or footer hooks. I don't have examples but this could be a starting point.

(e) I have also seen a tip of Ahmed in his Blog where he changes php files at runtime. I think the blog post was about overwriting existing AppGini php functions by string replacements and overwriting core php files.
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 25.10 + all AppGini Helper tools

mohamed
Veteran Member
Posts: 88
Joined: 2020-04-19 16:18

Re: How to keep Changings in TableName_View.php file Permanently?

Post by mohamed » 2020-10-26 09:51

Hi jsetzer,

Noted, will investigate the options and see what to do next.

Again, "Vielen Dank" for your time and valuable thoughts.
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

Post Reply