My Document based, Core Data application (using bindings in IB) has two entities, Employee (with an employeeName attribute) and TimeSheet (with timeDescription and entryDate attributes). Employee has a one(employeeDetails)-to-many(employeeTimeSheet) relationship with TimeSheet.
I'm constructing a Master-Detail set up for a TimeSheet entry.
For the Master I've got a one column tableView which has it's value bound to: EmployeeController (an NSArrayController using the Employee entity), arrangedObjects, employeeName.
I have a detailController (another NSArrayController) which is set up as an NSMutableDictionary which has it's contentSet bound to EmployeeController, selection, employeeTimeSheet.
I then have Detail tableView which has three columns, with their respective value bound to DetailController, arrangedObjects, employeeDetails.employeeName(column 0), entryDate(column 1) and timeDescription(column 2).
Now this all works fine, I can select an Employee from the Master Table and the Detail Table shows all the TimeSheet entries associated with that Employee. I can add entries using the selected Employee, everything works great.
My problem is, instead of having a tableView as a Master view, I wanted an NSPopupButton in it's place from which I can select an Employee and view all the time entries associated with that Employee.
I've tried every combination of content, value, arrangedObjects, selectedObject(s) etc. with every combination of the controllers I have but cannot get the NSPopupButton to behave in a similar way to the single column tableView.
I've searched in vain for more information on this and read through the bindings documentation several times but just keep getting mixed up. I feel this should be relatively simple but I just can't seem to get it. I've been racking my brains for almost two days now before posting on here.
Can anybody point out where I'm going wrong? I'd post code but that isn't really appropriate seeing it's mainly an IB thing.
Billy.
By the way: the detailController will populated with a new employee object "automatically". Make sure to set "managedObjectContext" to the same controller (employeeController).
Ok, I found it. I knew that after posting on here I'd find it straight away.
I bound the NSPopupButton content to EmployeeController, arrangedObjects, contentValue to EmployeeController, arrangedObjects, employeeName, and it's selectedIndex to EmployeeController, selectionIndex.
Works great.
Billy.
Related
I am trying to create a categorized view of all Notes documents that have a field with exact same value, i.e. there is a field for Contractor Name and I want to create a view that lists each Contractor and the documents that relevant to each. How do I do this? I have tried view formulas like the following but no success as yet
SELECT #IsAvailable(Contractorid) & #Count(Contractorid) > 1
SELECT #Count(#IsAvailable(Contractorid)) >1
Nsf databases are no relational databases. The count of different documents with a unique value in a specific field cannot be used to build a view selection formula.
You could write an agent, that runs through all documents and counts them and puts all with count > 1 in a folder, but this is quite a lot of LotusScript code and needs some advanced knowledge.
The other possibilit would be to categorize the view by ContractorId and add one column before that categorized column: simply use 1 as column formula and select "display totals" in the column properties as well as "hide details".
Then at least you have the information, how much documents are in each category, but unfortunately you cannot filter by it and you cannot sort by this column.
A third possibility would be to use an xpage interface, but that is even more work to do and a completely different story developmentwise.
This is similar to view to identify duplicates. My approach is to use folder.
Make a new folder with design of your view. Instead of (not working) selection formula use short LS code as an action, or QueryOpen event (make sure only one user runs the script).
The code should cooperate with another (hidden) view sorted by Contractorid. Make a ViewNavigator for that view and traverse through it with simple logic - if previous entry has the same Contractorid as the current one, put both documents into folder**. That way you will get list of all documents with duplicate Contractorid. Make sure to wipe all the current content from the folder at the start.
** This can be optimized further by slightly more complicated algorithm to handle first duplicate diferently - for more than two duplicates this algorithm makes extra calls of PutInFolder method.
I am working on an iPhone/iPad App that is using core data. I have a Table (Entity) that wants the user to select from another Table (relationship is setup in the model). I have worked through several tutorials, and it is working very well. Select one of the second table items, save the record. When I re-edit the record the correct value is properly showing. Great (since I am very new to this, I love how some of this works!).
However, if I click to bring up the Picker again - it defaults back to the top of the list, rather than the previously selected second record. All examples I could find have something in the Picker Class on viewDidLoad to set the selected row - to an integer? How would I know what row to select, since this is a table - not an array of fixed values?
I have conceptual issue with using core data. My app lists events by title in the main tableview then navigates to a tableview which is unique to the event. Here it's supposed to display in the section headers of the tableview an event date, a list of dates that expand a range (requires calculation) or list of unique dates.
I have arranged this in the model with 3 entities. Event & Date have a one to one relationship. Date to Menu have a one to many relationship. Menu contains the data for events that have unique dates, Dates contains events that either have a start date or in some cases when it's a range an end date.
Ok if the above is clear my question is how do I do create a list of section headers unique to an event? Bear in mind that NSFetchedResultsController only provides the ability to return a section name from a managedObject. I think this is what's throwing me.
Do I fetch the data unique to the event then use FRC to create arrays to populate the section headers and live with the table not being managed? Or is there a smarter way?
I don't really understand your model but I think it looks something like this:
Event{
name:string
date<-->Date.event
}
Date{
event<-->Event.date
menus<-->>Menu.date
}
Menu{
date<<-->Date.menus
}
If this isn't correct, you might try editing the question with the data model in this format it can be better understood. (if you can't edit, just fold the format into a comment and I will add it. Alternatively, send it me in an email.)
I'm not clear on what data you want in your Event table section titles. Sections are intended to be groupings of managed objects based on some attribute of those objects. The canonical example would be Contact.app's contact list. The contacts are grouped based on alphabetical value of the first letter of the last name.
Once common mistake is to think of a section table as representing hierarchal objects with the section titles representing superior objects and the rows representing inferior e.g. yo have a model to simulate a file system so you have a Directory entity and a File entity. You try to set the section titles to the name of the Directory and the rows to the names of the related File entities. That would not work smoothly and would not really mesh with the interface grammar that the user has learned for section titles. Instead, you should have a hierarchy of tableviews with a table showing all Directory objects and then a second table view showing all the File objects related to the selected `Directory object.
So, if the section titles you want come from any object besides Event you are probably approaching the problem from the wrong angle.
In my Infopath form I use a repeating table. On opening this form on sharepoint I would like to have some rows of the repeating table filled out using information from an other list. I use content types.
What i am working on is a Timesheet system where the user can register how many hours a week he worked on different projects.
I would like that by creation of a timesheet some predefined projects will be already inserted, meaning that the repeating table will have for example 5 rows already with 5 favourite or most used projects selected based on a separate PetProject list.
When I looked at the workflow in the list where the timesheet is being created I couldn’t find the column projectname in the dropdown so I cant give it a value. When I went to look in the Form settings of TimeSheets I saw that projectname cant be selected/edited, its in plain black whereas the other columns are blue and clickable. I thought its probably because the value of projectname is merged from the different rows in the repeating table.
Is there any way I can work around this problem and assign a value to projectname by creation of the timesheet?
Thank you so much!
I think that you will need to write some code to query the data that you are after and add the data to new rows in the repeating table.
There is a loading event that you can hook into to then query a secondary data source and then
add the row to the repeating table.
Will this run with in infopath as a thick client or will it run as a browser based form using infopath form service?
I have a Person field in my custom list. I want to have a view that will show multiple fields from that Person instead of the one I had to choose when creating the Person column.
So basically I want to have one column for Person and then in the view see Name, title, email, phone. All of those are valid choices but I can only pick one right now.
I really want to avoid typing in the username lookup for each column I choose to display.
This is SP 2007
It sounds like you need to create a custom fieldtype (with a fieldcontrol) that inherits from the userfield but in viewmode renders out the different columns you need. Is that something along the lines you are looking for?
http://www.sharepointblogs.com/nicksevens/archive/2007/08/31/create-custom-field-types-for-sharepoint.aspx
Note: This link is broken
You probably want a Computed Field. Note that this is not a Calculated Column. A Computed Field is what is used to display the same data is different ways. In SharePoint there is a Title field, but there is also a "Title (linked to item with edit menu)" computed field as well as a "Title (linked to item)" computed field.
See midway down this link for more details. I'm not sure if it will have all of the power that you need, but if it does it is almost certainly what you are looking for if you don't mind getting into the Schema XML file a little.
Could you use a DataView web part for this? If it's just a question of viewing the data that might be suitable.
Came across this thread and thought I'd add a tip. This suggestion is clearly not for every use case, but may work well in situations where you're managing a list rather than allowing manual inputs (verified to work with SP 2013):
Create a spreadsheet with columns to match your SharePoint list that contains multiple profile fields. (for example: name, phone number, email address)
In the spreadsheet, enter the same email address in all of the person/group field types in that row. (e.g., boss#company.com, boss#company.com, boss#company.com)
Select and copy the row(s) you wish to transfer to SharePoint.
In SharePoint, change the list view to "Quick Edit" and paste the row(s) into the grid.
SharePoint will process each field and convert the email address to the profile value you selected during the list setup.