• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Using placeholder in List Pre-filter: my error or fabrik error?

marcelf

Member
I'm trying to use pre-filter. I need to the records that are too old using the a value of a field element.

First like in the fabrik wiki I tried:
http://fabrikar.com/forums/index.php?wiki/list-pre-filters/

> Show records created before the estimated days to do the job (overdue)
where:
field = your-date-element
condition: less than
value: NOW()- INTERVAL '{jobs_estimated_days)' HOUR
type=no quotes

It didn't work. '{jobs_estimated_days)' isn't recognized using "no quotes".

So I tried to use EVAL. My Problem: the placeholder isn't working in the pre-filter value. Look the filter below.

pre-filter with placeholder.JPG I also created calc field to test with same code. It shouldn't show any record, but its showing:
list-results.JPG

In the calc works, but in the value using EVAL of pre-filter don't. Is it a Fabrik bug ?

Another solution: how can I store the result of calc when the list is viewed?

Thanks,
Marcel
 
I think this placeholder not work in pre-filter.
If your placeholder {documentos___id} is rowid on the pre-filtered list you can try with {rowid}.
If not right then use sql query.
Note:
in field value don't use return.
 
Hi,

I just tried {rowid} with all types (EVAL, query and no quotes) and it doesnt work.

I also already use return when EVAL is configured and it works for me:

$prazo=10; return date('Y-m-d H:i:s', strtotime("-$prazo months"));

But, the $prazo cant be a constant, it is an element in the form. So placeholder doesnt work:

$prazo='{assuntos___prazo}'; return date('Y-m-d H:i:s', strtotime("-$prazo days"));

How can I use SQL?
I dont understand in the wiki:
http://fabrikar.com/forums/index.php?wiki/list-pre-filters/
"Then {$q->a} can be used as a placeholder in the value field."


Should type be configured as Query in this case? But I need get the date today and subtract with period ($prazo), is this possible using Query?

Thank you for reply,
Marcel
 
In field Pre-filter query type your select query.
"Select id, parent_id from tablename where ...."
Then in field value you can get results from query like:
{$q->id} or {$q->parent_id}
 
Where is your 'jobs_estimated_days' field coming from?

You can't use normal element placeholders in a pre-filter, because ... well, it's a PRE filter. It's setting up the WHERE clause used to select the rows from your table. So at the point that WHERE clause is being built, we haven't yet loaded any of the rows, so there are no element values. Chicken and egg.

Also ... a pre-filter is a single WHERE clause used to select all the rows to display from the table. So even if we could magically know the value of a field we are about to select before we select it ... which row's value would we use?

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top