Variable definitions for themes

I’m trying to create a custom theme and having a headache trying to figure what variables are available and what is the proper syntax. Is there a page with list of ALL available variables that we can use in themes?

Please do not divert topics with unrelated questions. Start new topics instead. Yours was not related to employee codes for payslips. Your question has been moved to its own topic.

As has been answered on the forum many times in the past, the Plain theme includes all variables used for any type of transaction. Definitions of variables change according to the transaction being displayed.

thanks for moving the topic.

the reason i asked the question was because i was not able to find an answer to my question. the only relevant answer what i believe posted by you which provided a link that no longer works.

here is what i see in the plain theme… all available variables are not present in there…

there are no list of variables available.
like already informed the variables differ for every transaction form.
few common changes required by most users are explained in the guides section under the heading Themes. you can read them for ideas.
also, there are many users who have shared on the forum their pieces of code for various customization. you can search them too.

also, it should be noted that custom themes may break when there are major changes to Manager program itself. so the variables found on the forum maybe outdated and there is no guarantee the current variables would work in the future. you should be prepared to modify your custom theme in such cases.

Yes, they are. Many of them are arrays. For example, recipient.name will be a customer, supplier, payer, payee, employee, or a blank, depending on the form being displayed. And cell.text can be a date, item, description, quantity, unit price, amount, tax code, etc., depending on the context. The program fills the array according to what data must be shown in a table.

Understand that themes do not use the same variables as may be present in the database. They use a set of variables necessary for whatever is being displayed. Every built-in theme includes the same variables (except for the emphasis.text variable used to display PAID IN FULL and OVERDUE stamps on some sales invoices). That is because a theme can display all transaction types. Data from the database is mapped into the Liquid theme variables by the code that defines the particular transaction being displayed.

My guess is that you are looking for specific database variables to populate a theme. That is not how themes work. You can only use theme variables. As I already said, they are all there, and there are not very many because they are arrays instead of individual values.

Presumably then it would be possible to create a custom test theme which simply loops through each array, outputs each variable name (e.g. array.field) and the data value for that field in a format that’s easy for humans to read. Obviously it would only really serve as a guide for theme customisation but it would be useful, especially if it was available somewhere prominent on these forums or included in future releases seeing how often this question seems to get asked – going off the quick search which landed me here, at least. I’m no programmer but if I manage to put something like that together I’ll be sure to share it on here.

For others looking to put together their own solutions, I’ve been able to achieve a lot of what I needed to using {% capture %} and {% assign %} in Liquid, but I did find that quite a few of the variables I went to create at first were redundant and contained information already available elsewhere (mainly in the business array, in my case).

Yes, it is possible to traverse and display the contents of the variables passed to a theme (or localisation). I also agree it is an excellent idea to have a developers custom theme (and localisation) which does this. This would be a valuable resource when starting to develop a custom theme (or localisation) and also during debugging.

For an example if displaying variables see Localisation: GST/VAT worksheet programming guide - #4 by Patch In particular the exploration of the variable “objects”

The display control is easier in localisation but variable access is the same. Liquid is designed to allow access only to the information passed to the user procedure. The content of the data structure passed depends on what data has been entered into the current business, report settings, and which report is currently being displayed.

I was trying to create something myself from the link that @Patch attached but my code below just print “:” nothing before and after:

{% for field in business %}
{{ field.label }}:{{ field.text }}
{% endfor %}

I’m glad others feel the same, having a theme say called “All Variables” would be a tremendous help. I’m trying to create 1 custom theme that i can use for my reports and banging my head against a wall.

In general, themes are used for transaction form display, not reports. (The exception is customer and supplier statements.) Reports are the result of processing many transactions. Localizations, in turn, manipulate an already-defined report. So I think you are on a path that will lead nowhere.

Start with something like

<br>
Business {{ Business }} <br>
recipient {{ recipient }} <br>
table {{ table }} <br>
emphasis {{ emphasis }}  <br>
custom_fields {{ custom_fields }} <br>

Then expand components as appropriate

thank you @Patch ill give that a go!

@Tut my apologies for not being clear, I meant to say transactions such as invoice, quotations, etc.