I am creating summary eMails with recent activities that can be configured by the recipient. For that I am using Mandrill with the Handlebars templating syntax and {{#each objects}} passing in objects.
That all works fine. And I can use the {{else}} to display a message when that list is empty. (That event hasn't happened in the referenced period of time)
But now I want to give the user the option to never see a summary about that particular kind of event (no matter whether they exist or not). I tried using {{#if objects}} and simply not adding the parameter for that user. But that results in the entire block not showing up when the list is empty. But in that I case I just want to say something like "no recent activity in this category" which has been working fine so far.
TL;DR: How to differentiate between parameter not given and empty list given with handlebars.
Related
I have a Collection of Posts and a Collection of Users. Posts have certain attributes which are irrelevant for this, but they also have one attribute called tags right now its an array with certain words.
A User can follow certain Tags so he has a attribute followedTags which is also an Array right now that contains the Tags he follows.
Now one of the use cases for this is a User Feed to Show only Posts with Tags he follows, the Problem is that I only found methods to query this for ONE Attribute at a time(in Arrays). Since I dont wanna run 20 Querys for 1 Feed (For example if the user follows 20 Tags) I thought maybe I could make a smart change in the data modell itself, any suggestions?
Problem is that I only found methods to query this for ONE Attribute at a time(in Arrays)
If you try to chain multiple whereArrayContains() methods, you're most likely getting the following error:
Caused by: java.lang.IllegalArgumentException: Invalid Query. Queries only support having a single array-contains filter.
So unfortunately Firestore can only allow a single call to whereArrayContains() method in query.
Since I dont wanna run 20 Querys for 1 Feed (For example if the user follows 20 Tags)
If you have a reasonable number tags, you can create each tag as a separate property. In this case, it is allowed to call Firestore Query's whereEqualTo() multiple times.
If this is not the case, then you should consider augmenting your database structure to allow a reverse lookup by creating each tag as a seprate object (document) in a tagCollection. Under each document you can create a new collection named tagPost in which you should add all the posts that are labeled with a specific tag.
Super simple.
When viewing the list of Custom Forms in Setup, I want to add a column that shows where those Custom Forms are in use (or null if used nowhere).
This is similar in principle to viewing the list of fields, which has a list of forms on which those fields are used.
What is the syntax I can use to add the appropriate column(s) to the view?
As far as I know, there is no linkage in the backend that connects categories (custom forms) to their host objects. This is probably because the list could be massive and the query would take quite a while to execute as it would have to traverse every object in Workfront or each form would store every parent object ID.
Unfortunately, you can't even search for objects by associated category IDs, so if you wanted to build this yourself you would need to query each object and search its categories to see if your custom form appeared.
I have done research about setValue() and updateChildren(). I have tested both of them to add and update data from firebase database. From what I have learnt that both of them did the same exact thing and did some research about them.
From what I have learnt. The setValue() is used with a class object while updateChildren() is used with a Map or HashMap. Correct me if I'm wrong.
My question is as stated above, what is the difference between setValue() and updateChildren()?
'setValue' method is totally replacing the document (specified reference) with new data.
'updateChildren' method is just updating particular fields or add such fields if they did not exist before.
You often can get the same result using those methods, but actually they are different.
Using an example where your user has fields: Name, Birthday, Favourite Colour.
Set value requires you to set all the fields under the same parent node otherwise they are overwritten with no values and deleted.
However, using updateChildValue, you can specify which field you would like to update without altering other fields. And, if the field doesn't already exist, it will create a new field. This is especially useful if you just want to add a new field under the user like hair colour.
I have a json array variable defined in my activity workflow definition. Now, I need to present the data of the json array in a datagrid inside a form task. One of those columns should be a check entry filed so that the user may select some rows. After that, I need to get back that data in a subsequent form task (so I need the data to be updated in the json variable so I can read it back, mainly the user selected checks).
Any example to accomplish this? I didnt find almos nothing relating with using datagrids in Alfresco task forms.
thank you!
Miguel
I'm retrieving a list of categories (and subcategories) from Mongo and I need to bind these values to a list of html elements that represent the categories in the view.
When I retrieve this from the server I save it in a Session object. I'm trying to write a loop that goes through this object and binds the data with jQuery.data() to the list html elements.
However I can't access the collection from within the Session object in Meteor. I can in the browser! I can drill down to categories.collection.queries[1].results and I can see the category objects. If I use this in Meteor I get undefined error.
Any ideas what I'm doing wrong? Many thanks
As suggested in the comments I'm already using {{#each categories}} in my template. But once the categories are rendered I want to bind data values to them from the same collection.