Menu

Allow conditional naming of captions on fields

0 votes

I am developing a small workflow application where a child table is used to record the various steps in the workflow (ProcessStep).
Each of the steps has three possible documents attached to it, stored in the filestream column names Document1, Document2 & Document3. But they refer to different things at each step.

e.g. In the Initial step, these Documents refer to
1) The Application Form,
2) The Medical Report;
whilst in another step, the Competency Completion Step they refer to
1) The Personal Track Safety Course results,
2) The Health & Safety Report results.

So, based on what the step is (identified by a value in the ProcessStep.StepName column, I'd like to define what the caption name is on the Form Field along the lines of a CASE statement e.g. for the column Document1

CASE 
  WHEN StepName = 'Initial' THEN 'Application Form'
  WHEN StepName = 'Competency Completion' THEN 'Personal Track Safety Report'
  ELSE 'Document'
END

Will dbFront have the information from the database in order to do this prior to rendering the Form Fields (I appreciate that it may not be possible to change the table grid column headings from the Document1, Document2, Document 3 names.

Regards
Colin

in Customization by (1.2k points)
edited by

1 Answer

0 votes
 
Best answer

Hello Colin, this is an interesting question.

On Form - Solution

One solution is to hide the form label or make it generic. You can then proceed that field by a custom view field that returns a custom hard coded message using the case statement you already presented in your question.

This would be similar to: Context Specific Help, except much simpler since you only need a view to return your new caption or message.

You would then join that view to this table and then display its value in a field. The field label would be set to "Inline". This serves two purposes. In the first case it hides the label when there is a value, in the second case it allows you to set a default label caption when no row is selected or the value is blank.

To complete the effect you could apply a css class to the custom label field and touch it up so that it looks the way you want it to.

On Table - Can't

It's not possible to adjust the table column name on a record by record basis because the table needs to show multiple rows with one column header. The only option is to pick a very generic column name.

by (64.3k points)
selected by
This is indeed a good solution using the existing functionality of dbFront and I'm happy to use it for my workflow application although it will need some detailed documentation in the views to ensure someone else at a later date will know what is going on. However this solution and the one I proposed still can't truly achieve the proper captioning of the columns for new rows simply because (in my own case) the process step hasn't yet been defined.
Hello Colin, I updated the answer to cover your concern.  Change the Field label visibility to "Inline".  This will allow you to use the regular view label as a default value.  You can of course change the view label as needed.
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
 |
Powered by Question2Answer
...