NotApplicable marker with display pattern - cocoa

Ok, so I'm pretty new to Cocoa, especially Bindings, but here's what I'm trying to do. I've got a Core Data model consisting of two entities: Category and Item. Category has a to-many relationship to Item called children, and Item has a relationship to Category called parent. Item has two attributes that Category does not have: quantity and desiredQuantity. What I'd like to do is display the tree in an NSOutlineView with two columns. One column is bound to the name of either the Category or the Item. I want to the second column to display something along the lines of
2 of 5
for the Item rows and nothing at all for the Category rows. When I use a display pattern, the Category rows end up showing
of
I noticed that if I don't use a display pattern for the second column, and instead just bind its Value to either the quantity or the desiredQuantity, the Category rows show nothing; its only if I try to use the display pattern.
How can I make it display nothing for the Category rows and still use the display pattern? Or can I?
Edit:
I guess I didn't explain what the NotApplicable marker has to do with anything - Category does have properties for quantity and desiredQuantity, but they just return NSNotApplicableMarker.

This looks like a job for a custom NSFormatter or just a read-only NSString property called "paginationString" ...

Related

How can I add existing items to a matrix in netsuite?

I have several items in Netsuite that I want to group together but it seems like I can only add items to a matrix if they're new.
Once an item is created you cannot change its type and whether an item is a matrix item or not is part of its type. The only exception to this is where you can convert a non inventory item to inventory item.
However if the driver for this is how you display items on your website there are a number of ways to deal with this.
Both of these require some JavaScript skills
One is to create a site category and assign your "matrix" items to that. Then create an item list template for the category that makes it look like a buy page.
The other is to link the items under a new parent item ( can be natural parent field or custom item field) and use Ajax calls to a suitelet to load the child items and organize the page

Change default position of product in categories from 1 to product ID in Magento 1.7.0.2

In Magento 1.7.0.2, I am adding a lot of products from the backend but the positions of these new items in their corresponding categories are 0 or 1. So when sorting on the frontend, I get arbitrary sorting by postion.
I set the position of these items in their categories to be equal to the product_id directly on the database (table catalog_category_product), and sorting works correctly. So the solution is to set the position of the product in a category to be equal to the product_id in the code, but I don't know where and how to do that.
Any help?
Many thanks
Ok so the function _saveCategories in the class Mage_Catalog_Model_Resource_Product this appears to do what you are looking for. Have a look around for the call to insertMultiple. This will take in a $data array containing category_id, product_id and position (which oddly is always set to 1)
I would think that at this point you can make your edit. Though I would suggest that you rewrite the class rather than editing the core code.

How to change the relationship field in Pyrostreams entry form

I'm using Pyrostreams and I have 2 streams:
Cities &
Rooms
Rooms have a relationship field: City. When I output an entry form for Rooms I see a dropdown with all cities, but only their id's are shown. How can I show a specific field in the dropdowns of relationships (such as city_name)?
From Adam Fairholm on the forum of PyroCMS:
You need to set the title column of the stream by going into the field
you want to show and choosing Make Field the Title Column. This only
works for fields that have text to display, obviously, since it needs
to be shown in a drop down.

When Dependant column in DatagridView then how to filter the data because privious selected items are disappear

In my datagridview there are two dependent columns, one is category and the other is items. So I want to filter my item column list as per selected category.
But the problem is that when I change the category wise data to datasource of items combobox, previous selected items names disappear because previous items is not in current datasource.
So what is correct solution of such problem.
Filter columns with a Dataview: http://msdn.microsoft.com/en-us/library/system.data.dataview.aspx
Depending on input validation and what not, you can update the DataSource after an edit operation.

Updating Value in Core Data

I'm trying to write a simple stock check program, and I have a Table View binded to Core Data. The table has 3 columns: Model, Price and Quantity In Stock.
I have a NSTextField and a NSButton underneath this, so that the user can enter the quantity they wish to buy, and when they click "add to cart", the program should fetch the value in the "quantity in stock" column, in the selected row, and deduct the value entered into the NSTextField, obviously, it would return an error is there isn't enough in stock. At the same time, the whole row, model, price and quantity desired should be added to an "invoice".
My question is this: How would I go about retrieving the value in the quantity field at the selected row, manipulating it, and reinserting it into the table?
Or would I have to edit the Core Data directly? And how would I go about that?
Many thanks,
Michael
I assume the table is, in fact, bound to an NSArrayController instance. The controller's selectedObjects property is what you want.

Resources