I'm just learning jsonschema. It's not clear to me what the difference is between items and properties. Can someone please explain?
items is for validating arrays, properties is for validating objects.
The value of items must be a JSON Schema object or an array JSON Schema objects (let's ignore if it's an array for now). The array that the items key word is applicable to, passes validation if all items in that array validate against the schema.
The value of properties must be an object. Each value in the object must be a json schema. The schemas in the object are applied to the instance object when the keys match.
Related
I need to retrieve object store value in DataWeaveComponent. Some of the suggestions given were to store the value in flowvariable and use it. Well it does not work in my case, Because I am transforming a collection of 1000 records in DataWeave. For each record, I need to fetch the value from object store and store it to a field. Any ideas would be highly appreciated.
You can create a flow that does what you want and then use the lookup function to execute it from DataWeave.
There are multiple ways you can achieve this
1.Storing the entire value from object store to a flowVars and access it,Dont create multiple variable foe each time
2.Create lookup in data weave then in the lookup flow retrive the object store content.But you will invoke object store every single time.
My suggestion is to fetch the content of Obj store and add it to flowVars.
Please let me know in comment if need further clarification.
I have a strange request and I'm not sure there is a better way other than simply brute force, but I have a CActiveDataProvider being rendered and virtual properties of the underlying Model are being used.
I would like to be able to pass extra information to that Model to filter the calculations in those virtual properties.
For example, assume there is a virtual property method getCreated_Widget_Count() that returns the number of widgets that the entity (let's say it is a widget maker) has created it its lifetime.
I would like to be able to filter the count to a specific date range.
So I want to be Create a CActiveDataProvider and use it in a CListView to display each of the elements, and the view is accessing property created_widget_count. But I want it to, sometimes, limit the result to a number based on an date range.
The obvious thing to do is iterate over the entire data set first and set the range to filter in each object, but I was hoping that there was a way to pass information to the CActiveDataProvider that could get into each constructor so that could be done while they are being built.
Any ideas?
This question is related to my previous question, Creating a Rails partial that is model-agnostic.
I am trying to create a Rails partial that is given a variable, say, seasonal_type, and does several different operations, such as querying a resource, and accessing instance variables, based on the value of the variable.
To be more concrete: I have the two models SafetyTest and TeamDue, which belong to Student. In one particular case in this partial, I need to call either
#student.safety_tests or #student.team_dues. I would like to pass the variable seasonal_type to the partial and like that determine which of the two is executed. How would I be able to do this? The value of the variable could be whatever is most convenient, such as a symbol (:safety_test) or a model (SafetyTest).
There is also another part to this question. In my controller, I precaculcated some instance variables for SafetyTest and TeamDue, such as #valid_safety_test and #valid_team_due. In my partial, how can I use either of these two instance variables, based on the value of seasonal_type? Or should I just calculate these values inside the partial, even though that would be against the MVC structure?
Any help would be much appreciated.
Here is the answer:
In my controller, I created an array with the models of both seasonal types: [SafetyTest, TeamDue]
Then I iterated over this array, and used the model to query all the information that I needed from the database. I put that information into an array and passed it on to the view with an instance variable. So this array also has two items, one for SafetyTest and one for TeamDue.
Then the partial iterates through this array and renders the view necessary.
I am provided a reference to a NSArray that contains data items. In my Custom View controller that acts as a data source for the table view, I interpret each item and present it as a cell.
So far so good.
Now there is a requirement from my colleagues to implement a filter, that will be based on values of one of the item's properties.
This property has enumerated values (4 of them). So when I apply the filter, i should see only items that match the particular value.
My question is how should I approach this filtering of that data.
1) Should I set the _data private variable to point to the original data source, and then override the "data" property getter to take into account the filtering?
2) Should I generate a separate filteredData array inside my controller?
3) Some other approach?
NOTE> coredata+fetched resultscontr. is out of the question. The number of items never will be more then 150-200.
I would go with the second choice. Having a filteredDatasource is more convenient. This way, you are able to know , not only the cells you should display, but also how many they are etc. Moreover, if in the future you want to sort them and use sections, you will be far more flexible.
For example when you implement the method – tableView:numberOfRowsInSection: which is called many times internally using the filtered data source you do not have to traverse through the array's objects many times so as to see which of them should pass the filter. You just return [filteredDatasource count]. This is more efficient.
In the apps I work on we have a array of all items and a copy which is the one the datasource refers to. When a filter is applied it replaces the copy but is based on the original array. So I guess #2.
What's the best practise way to handle a primary key in an unbound datagrid view combo-box column?
I want to display a meaningful value but store only the primary key (much like Access combo-boxes). I achieve this with a regular combo-box by adding an object with two properties into the items collection rather than a plain string. I then retrieve this by casting the selected index value of the combo-box back into it's object form and then retrieving the properties. This works very well but I am unable to replicate the technique with a datagridview combo as I can't seem to access the items collection. I only seem to be able to retrieve a string value back from the grid although I can add the object as normal when creating the column.
Hope this makes sense...
RESOLVED - Set the combo datasource to a collection class and use the ValueMember and DisplayMember properties in the same way as when binding to a datasource. Works a treat.