I have the following in my story that I am trying to match
!-- Block 1
When I "action" of document "document" to "status" and nextAction
When I "action" for document "document" to "status" and nextAction
When I "action" document "document" to "status" and nextAction
!-- Block 2
When I "action" of document "document" and nextAction
When I "action" for document "document" and nextAction
When I "action" document "document" and nextAction
!-- Block 3
When I "action" of document "document" to "status"
When I "action" for document "document" to "status"
When I "action" document "document" to "status"
!-- Block 4
When I "action" of document "document"
When I "action" for document "document"
When I "action" document "document"
Between "action" and document there may be of, for or empty
to "status" is optional
and nextAction is optional
In the steps file I have the following
#When ("I \"$action\"{| of| for} document \"$document\"{ to \"$status\"|}{ and $nextAction|}")
This is matching blocks 1 and 2 but not blocks 3 and 4 from the story file.
Can you give me some pointers as to how I need to amend the steps file to be able to match all 4 blocks?
I have tried adding aliases with the to status and the and next action removed however JBehave errors with a duplicate candidate steps error.
Thank you
If the only variation is the 2x2 grid of options on (to "status") included or not and (nextAction) included or not - then I would just have the 4 annotated methods with the "of|for" variant. Then have all those methods call into the one method (unannotated).
That will be much cleaner than using variants to include/exclude whole phrases.
Also most of the JBehave folks don't watch StackOverflow so I'd ask the user list as well.
Related
I have a "Date" field named "X". I have another field "Y" that references a "Field" type.
I would like to get just the "Year" value from "X" into "Y".
I would prefer doing this using GUI instead of adding/modifying PHP code. Is there a module that can help accomplish this?
Both "X" and "Y" are in the same Content Type.
Thanks for the help!!
Within views module you can group by date without having to duplicate a datetime/timestamp field only to retrieve the year part. For you custom view :
Under format title, use "fields" beside "show", select your prefer settings
Under Fields title, select the date field you need to tune, Formatter as default and Date format as Custom. As Custom date format put Y (see here https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-parameters). If desired field can be hidden from the view, up to you.
Return under format title, format -> Settings : there you can choose your grouping field you just created, even if hidden.
This is out of the box but I advise you to play around with views settings, one at the time, to understand what changes what.
Views is very powerful.
I have content type "Novel" and have relation with "Tag" and "Genre", I want to only show "Tag" and "Genre" in 'findOne' but not in 'find'. using m.unset in models/Novels.js only working if the data is not relation. how can I un-populate this Tag in 'find'?
You can deal with that by updating the find function of the Novel API.
📚Here is the documentation to update the controller function https://strapi.io/documentation/3.0.0-beta.x/guides/controllers.html
You will have to copy and past the find function code.
And replace return strapi.services.product.find(ctx.query); by return strapi.services.product.find(ctx.query, []);
We add an empty array because the second argument is here to specify data you want to populate. By passing an empty array you say to not populate data.
I'm trying to understand how to retrieve data from a Firebase database based on multiple tags. Let's consider the following data structure:
{
"posts":{
"post1":{
"title":"First post",
"description":"that's a nice post",
"tag": ["tag1","tag2","tag3"]
},
"post2":{
"title":"Second post",
"description":"the best post",
"tag": ["tag4","tag5","tag6"]
},
"post3":{
"title":"Third post",
"description":"cool post",
"tag": ["tag5","tag80","tag90"]
}
}
}
Each post has a title, description and an arbitrary size array of tags.
My goal is to show the user only the posts having specific tags. For example I may search for tag1 and tag4, then I want to show post1 and post2 to the user. Or search for tag1 and tag5, then all the three posts must be shown.
Tags in each post are not predefine keywords, they could be any possible word because could also be the case that a user set these tags. So could be that I search for tag100 but nothing is in the database.
I've seen couple of similar posts but I couldn't adapt any of them to this case. Can you give me some hints about the best strategy to handle this problem?
I'd recommend creating a separate structure for "tags", something like this:
{
"posts":{
"post1":{
"title":"First post",
"description":"that's a nice post",
"tag": ["tag1","tag2","tag100"]
},
"post2":{
"title":"Second post",
"description":"the best post",
"tag": ["tag2","tag3","tag100"]
}
// more posts...
},
"tags":{
"tag1": ["post1"],
"tag2": ["post1","post2"],
"tag3": ["post2"],
"tag100": ["post1","post2"]
}
}
This way, every time you add a post, you can take tags from that new post and check if they exist in the "tags" structure. If the tag DOES exist already, just push the post onto the end of the array. If the tag DOES NOT exist, create that tag property and add that post in an array as the value.
When you look for posts with any searched tag in the future, you just need to go into the "tags" structure, find any arrays with the searched tag names, use those post titles to get specific posts, and you're on your way.
Note: To add values to the Tag arrays (both in the "posts" and "tags" structures), you should probably use the .push() functionality described in the docs here.
Hopefully this helps!
I am trying to iterate in my template a list of objects included in an array field of a Mongo DB document using the Meteor platform.
So for example I create a MongoDB Posts collection of documents with the following JSON structure:
_id: "xyxyxyxy",
title: "my first post",
description: "a very intresting post",
comments:[
{comment:"a very cool post"},{createdBy: Meteor.userId()},
{comment:"I don't like this post"},{createdBy: Meteor.userId()}
]
Every logged-in user can add a comment that will be listed under the title and the description of a single post detail view.
So I set my template helper in my js file and added {{#each}} spacebars helper in my HTML file.
When I try to iterate the post document I get the title, the description but cannot get the values of my nested objects (comments). Instead, I get the following expression: "Object object".
How can I access those values so that I can show the comments related to the post and the user who added the comment? Thanks
Please note: I am not using aldeed simple-schema and not using pub/sub pattern. As of now I am intrested in understanding the templating part of the framework.
You will need to have two {{#each}}, one to iterate over the Posts and then one inside that to iterate over comments because they are in an array structure, using the below you shouldn't need to change or define any new template helpers:
{{#each posts}}
{{title}}
{{description}}
{{#each comments}}
{{createdBy}}
{{comment}}
{{/each}}
{{/each}}
That's normal, I don't know why you've wrapped your inner object comment into array, you should have this structure:
_id: "xyxyxyxy",
title: "my first post",
description: "a very intresting post",
comments:[
{comment:"a very cool post",createdBy: Meteor.userId()},
{comment:"I don't like this post",createdBy: Meteor.userId()}
]
similar case using meteor-blaze where I have users database with structure like below:
"_id": "abcdefojsdoijfodsjoijfe",
"username": "testuser",
"emails" : [
{ "address": "testuser#test.com",
"verified": "false"}
]
The nested each solution like provided by Philip Pryde above will work perfectly as the calling for database such as emails.address won't work.
So if I want to display username and email address,
need to do like below
{{#each usernames}}
<p>your username: {{username}}</p>
{{#each emails}}
<p>your email: {{address}}</p>
{{/each}}
{{/each}}
I am using PI Historian to read values from some Tag Points.
I am using this particular Historian software http://www.osisoft.com/
I would like to know if I can get it to show results if contains certain "text" or "result"
Where is says Tag Mask I can put Tag I want search for, after I get that Tag, then I can do a current value or sampled data, or timed, or calculated.
Instead I would like it to show tag which have current value of example "book" Quality tag
"book" would be a digital state string for a digital tag. In order to search for that, you would simply go to the box that says "Value" and click on the right pointing arrow and change it to "Status". You can then enter "book" and it will return a list of all of the tags that have that status.
I apparently don't have enough reputation points to post a screenshot yet.