Dynamic Labels
The purpose of this page is to help you create dynamic labels in iDempiere. There are times when you need to change a label based on some situation:
- You are creating a configuration page and you want the label the user sees to correspond to some setting for a given external source. Example: Shopify URL vs Magento URL
- You are asking the user questions (like a form) and you want the prompt to change depending on the question.
Quick description of the solution:
- Create two fields where one is a read only Column SQL (this is the label) and the second is where the user types in the actual data to be stored.
- Flag both fields as Window, Tab and Field window => Tab subtab => Field subtab => Field Only field = Y. This means that neither field will have a label.
- Place the Column SQL read only field on your window in location 1 span 1. NOTE: this is where most labels go.
- Place the field that holds the user data (text, number, date, etc...) right next to your Column SQL field at location 1 span 2 (you can span as many columns as you wish). NOTE: this is where most fields go.
- When you view the window, you will see the two fields right next to each other. The read only field sort of looks like a label (but uglier).
- To make the read only field look much better, update the Window, Tab and Field window => Tab subtab => Field subtab => Field Style field to look something like this: "text-align: right; padding: 0px; border: none; background: inherit;" This will make the read only field look just like a label.
Note that using Column SQL is just one way of updating the label value. You can use any of the programming tools available to you to set a fields value (Column SQL, Callout, Default Value, etc...)