This topic is locked

Link to custom view page

8/13/2022 3:42:46 PM
PHPRunner General questions
aadham author

Hi

I have five tables (languages>sections>topics>dialog>phrases) and I've created a custom view from the 'phrases' table to display all the phrases under any selected language. I'm using PHPRunner 10.6 and MySql.

Here's the language table:

`LID`,
`language`

The phrases table:

`PHID`,
`LID`,
`SID`,
`TID`,
`DID`,
`word1`,
`color1`,
`word2`,
`color2`,
`word3`,
`color3`,
`word4`,
`color4`,
`word5`,
`color5`,
`word6`,
`color6`,
`word7`,
`color7`,
`word8`,
`color8`

The custom view query:

SELECT
`PHID`,
`LID`,
`SID`,
`TID`,
`DID`,
CONCAT_WS(' ', NULLIF(word1, ''), NULLIF(word2, ''), NULLIF(word3, ''), NULLIF(word4, ''), NULLIF(word5, ''), NULLIF(word6, ''), NULLIF(word7, ''), NULLIF(word8, '')) AS `phrase`,
CONCAT_WS(' ', NULLIF(color1, ''), NULLIF(color2, ''), NULLIF(color3, ''), NULLIF(color4, ''), NULLIF(color5, ''), NULLIF(color6, ''), NULLIF(color7, ''), NULLIF(color8, '')) AS `color`
FROM `phrases`
WHERE (`LID` = ':language.LID')

What's the best approach to achieve this? Would a custom button placed next to each language on the languages list page do the job? If so, I'd much appreciate an example.

Many thanks in advance

aadham author 8/15/2022

Hi again,

Any tips/links would be truly appreciated.

Thanks

Dalkeith 8/15/2022

I've done something like this before with accounting periods..

So I have a query like you and I need to change the accounting records in the period - so my accounting period is like your where clause.

In phprunner I setup a list /edit / add forms based on a predefined view.

I have another list displayed through phprunner where the user can define periods which they are interested in. And I have a button in that table that when pressed takes the parameters and alters the view using the parameters... So in this case you have forms based on the view you have a separate form with all the languages and a button in there that when pressed alters the sql of the view changing out the where clause with the language relative to the button.

I documented it below for SQL Server but I see no reason why it wouldn't work in any database

Changing the SQL of a View through PHPRunner - SQL Azure