There is often a situation where multiple entities are recognized and you may want to loop through all recognized entities and create a response that includes each of them. e.g. through the elements of an array while creating the response.
I tried using the "argument ? command1 : command 2" and nesting further arguments in command 1 to create a sort of looping but this way is very error prone.
Any easy way of doing it?
You can control this from context and SDK throught API.
When you send message to Conversation you get intents and entities array. You can loop it throught your code and send or concatenate response.
If you can share workspace I can help
If you have Multiple Entity of same type then you can use #EntityName.values to store all the values of that enitity.It will be stored in form of array.
And if your requirement is different You can use loop.
Related
I am parsing an XML document to JSON, and eventhough I have the type array declared in the json schema, if there is just one element in the array it gets transformed into an objet like this.
"ListOfCodes":{"Codes":{{"Code":"111"}}}
but I need this:
"ListOfCodes":{"Codes":[{"Code":"111"}]}
I have several arrays in the document and I only get the sqare brackets when there is a multiple array.
and adding the properties manually is not an option.
Anyone know what can i modify to fix this in the logic app?
Unfortunately, there isn't a good solution for us to implement this requirement in logic app. Here is another post which is similar to your problem. To implement the requirement, we can just:
1. Use the "Compose" action to generate the object by hand (manually put all the properties and arrays where they need, potentially using the #array() action.
2. Call an Azure Function or some external code that can more specifically craft a valid JSON.
I also try to test it in some other way, such as use json:Array="true" and use <?xml-multiple?> but they all fail in logic app. So I think the only above two solutions(mentioned in that post) can be used. Neither approach is good, though.
I am new to the MEAN STACK and I am being asked to complete a project on the entry and exit of a user. The username of every user is stored in another collection. So, I want 2 models in a single module using the MEAN stack. Is it possible to make two models in a single module? I am using mongodb as the back end.
Kindly give a response. Thanks.
Yes you can call more than one Model & perform your queries,
Even you can try 2 collections in one collection.
Read About nested collections in MongoDB/Mongoose
http://mongoosejs.com/docs/subdocs.html
I have a recurring problem with single-item json data sources that are consistently rejected by a C data parser looking for the parent/child structure of a multi-item feed.
Where is it easiest to fix this - on my end, when I create the feeds, or for the C programmer to add a couple lines to also let it accept data that looks like object?
The error message I get is
Cannot access child value on Newtonsoft.Json.Linq.JProperty
which tells me it looks around the house for children that don't exist, like a nosy aunt.
In case you need to know how the data is processed, I use yql to standardize various sources so the parser can import everything into the right MongoDB fields. Everything is generated dynamically a few times a day and I can't do anything about the sources that will only deliver one update at a time.
Here's an example of json rejected because it looks like an object.
{"item":
{
"artist":"Morphine",
"song":"Thursday",
"station":"WXXX",
"feeddate":"1438014574000",
"dttype":"utc"
}
}
The one whose fault it is, has to fix it. Simple. Look up the specification what you are allowed to pass to the parser.
Is it possible to have multiple VOICE_CALL options for a given TimelineItem? A scenario would be that I have a Store that has multiple contact numbers. One would be for the 800 number while a second option would be to call a specific store location directly. I have tried adding multiple MenuItems whose action is VOICE_CALL, but not surprisingly it only recognizes the first. Is something like this possible with custom menu items? I am currently writing this in Java.
This is not yet possible with the API. Please file a feature request on our issues tracker if you'd like to see this implemented.
I'm trying to figure out how to get nested structs to work with GAE datastore using Go. I know the datastore doesn't specifically support nested structs. I need to find a simple way of getting user information to go with a post when it is sent out to a user as JSON.
One thing I thought of was to put two fields for the user. One for the ID/key referencing to user and another one for the user type struct which would be added there when the post is loaded from the datastore. Extra fields seem silly so I'm hoping there is a better solution for this.
There are two entity types or structs: POST and USER
Posts need to contain information about the user who made the post.
The structure for the JSON I'm going to output for users is as follows:
POST
field1
field2
USER
user_field1
user_Field2
Go's appengine datastore api provides the PropertyLoadSaver interface for this sort of thing: https://developers.google.com/appengine/docs/go/datastore/reference#PropertyLoadSaver
You structure your struct however you want and then implement the Load and Save methods of that interface to populate it correctly. It means you write the serialization code yourself but it gives you full freedom in how you structure your data.
This will allow you still filter over the fields and have a nested struct.
The python runtime has the ndb library which supports nested structures like this. Go does not, so I can think of two solutions:
In the POST kind, have a user field that is a key, referencing a USER kind with the necessary fields. Requires two fetches and roundtrips.
Make a user field in the POST kind that is a blob. The blob is a string that is [de]serialized in go. This means you can't search or filter on any of the user data, but it also allows you to store everything in one entity.
You should use these based on the needs of your app. If you need users to be a real thing, use 1. If users aren't objects you need to work with (i.e., just data to display), you can use 2.