Custom Column Names in Export

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
ImplexSQL
User
Posts: 16

Custom Column Names in Export

Post by ImplexSQL »

Hello.

I wish to customize some column names during export. Specifically, I'd like to query a table and retrieve some values based on the CurrentUserID(), then use the resulting values as the column names. So the values are not in the lang XML, rather from a data table based on the user.

It appears to me that this would be done in the applicable *info.php file in the $Doc->ExportTableHeader() section, but everything I try either has no affect or kills the columns I mess with.

So, I seek guidance.

Thank you in advance.


mobhar
User
Posts: 11735

Post by mobhar »

Does it mean you do not do anything for that $Doc->ExportTableHeader() section?


mobhar
User
Posts: 11735

Post by mobhar »

Well, all right then. Assume the table name is "orderdetails", the field name is "OrderID", and you want to change it become "My Order ID", then simply put the following code in "Page_Load" server event:

if ($this->Export <> "") {
Language()->setFieldPhrase("orderdetails", "OrderID", "fldcaption", "My Order ID");
}


ImplexSQL
User
Posts: 16

Post by ImplexSQL »

Brilliant! Thank you very much, mobhar! This indeed does exactly what I sought. I very much appreciate your assistance.


Post Reply