This topic is locked
[SOLVED]

 setFieldLabel in a view

1/14/2019 4:31:25 AM
PHPRunner General questions
T
tisento author

Hello,
i need to change the labels of a field dynamicly. No problem with a single table as described in the manual on

https://xlinesoft.com/phprunner/docs/setfieldlabel.htm.
I don't wanto to use $dal because it is deprecated (see manual).
Setting new labels with

Labels::setFieldLabel($table, $field, $label, $language)



in AfterAppInit, AfterTableInit, BeforeProcess events works pretty well.
Example:



SELECT

products_name,

products_description

FROM products_description



Works excellent:



Labels::setFieldLabel("products_description", "products_description", "New Description");


But how does this work in views?
Example:



SELECT

products.products_id,

products.products_image,

products_description.products_name,

products_description.products_description

FROM products

INNER JOIN products_description ON products.products_id = products_description.products_id


I tried:

Labels::setFieldLabel("products_description", "products_description", "New Description");



==> no change of label
Next i tried setting

$table = products_with_description



(with "products_with_description" as name of my view)

==> no change of label
So what is the value i have to use in $table - or is this the wrong way to change labels in views?

admin 1/14/2019

It works in views the same way:

Labels::setFieldLabel("view name", "field name", "New Label");
T
tisento author 1/15/2019

Thanks,
i tried exactly what you answered. Same syntax for tables and views. I can get it to work with a single table, but not with a view of joined tables.

Labels::setFieldLabel("view name", "field name", "New Label");


But unfortunately that did not work as expected, no change of labels on ListPage.
Maybe i am using the wrong view name. I used the name, it has in "tables" --> "custom views" in phprunner.

Where can i find the name, i have to use?
What values are allowed in the name. I use a-Z, 0-9, space, underscore. ==> Meanwhile tested with simple name like "testview", no change of labels.
Maybe it is the wrong event (AfterTableInit) i use for a view, gonna test BeforeProcess pretty soon. ==> No change at all (ListPage).
PHPRunner version: Enterprise 10.0 Buld 32290 x64

T
tisento author 1/15/2019

Hello,
it works as described by admin.
Why not at once? I do not now!

I just cleared browser caches, restartet XAMPP, made a full build - et voila: it works!
Thanks a lot, sometimes things are pretty easy. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=86774&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />