different lists in the same template

Helo!
I'm building a template for a stripe (let's call it list A) and pdf of that list.

I have another table (let's call table B) and I would like to get some fields from this other table to compose the template of table A.

Would it be possible?

If so, how would I do it?

Thanks!
 
Join table B to table A and you'll have all the elements available from the table B for your PDF-creation.
 
did not work @juuser

Other fields ended up joining... the form of B appeared in the form of A....

Wouldn't there be a way for me to get just one field from another table via php for example? Because I only need this information in the pdf template and not in the list or form?

Thanks!
 
Wouldn't there be a way for me to get just one field from another table via php for example? Because I only need this information in the pdf template and not in the list or form?

Sure. You can write your own DB query in a custom PDF template.

Or alternatively, involving multiple steps, you could
- create a copy of your original list A
- join list B with this copy
- in the backend listing of elements, disable the list B elements from being displayed in the list except the one you want to show
- then base your PDF on this list copy (while elsewhere you keep using the original, "unjoined" lists and forms)
 
...or you can use calc element in your list A to get any value from list B. Just make sure "Only calc on save" is set to "Yes". And you need to update the calc element field for already existing rows in your list A either by editing and saving the record or with larger amount of rows it's reasonable to use e.g. PhpMyAdmin.
 
did not work @lousyfool :(
Because in the "Copy" list it doesn't store anything, as it's a copy, it throws everything to the "A-list"
And list A doesn't have the elements I need from "table B". And in the "copy list" I can't generate the pdf with the contents, because everything is being saved in the "A list".

@juuser to use the calc element, I would have to use
"return {'table_complete_element_name'} ?
 
I don't know what problem you have with lousyfool's suggestion, but when you want to get element data from another table which is not joined to your main table, you cannot use placeholders.

In calc element you have to use something like:
Code:
$mydb = JFactory::getDBO();
$mydb->setQuery("SELECT b.myfield FROM tableA AS a LEFT JOIN tableB AS b ON a.id = b.tableb___join_element WHERE a.id = '{rowid}' ");
return $mydb->loadResult();
 
Hey
partially managed to resolve @juuser and @lousyfool

I joined table B with a copy of table A, this copy is called 'copy A'

Now I have another problem:

I have in table B records made by each user. I need that in the tablema 'copy A' appear in a field only the records that the corresponding user made in table B, in isolation, each one seeing only what itself registered in list B.

Could I do this natively?

Thanks!
upload_2021-7-19_23-17-37.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top