Infopath Newbie - Populate field from lookup value - sharepoint

There are explanations for this all over the web, but none I have followed a) seem to work, b) explain how to achieve this in simple noob terms, c) show any sort of diagram, or d) make assumptions that you want to start jumping right into code...
I have a form for users to log training they have completed. I have a sharepoint list with the course name and the duration in hours.
When the user opens the infopath form, it populates a read-only field with their username, and populates a dropdown with the list of available training courses from my sharepoint list.
All I want to do is to populate another read-only field with the duration of the course... But I just cant find the right filter settings to do it.
Currently I have the default value of the duration field in my form set to the formula:
Duration(from SP list)[Course Title (from SP list) = Training Course (from form lookup field)]
But this is not returning any values...
This is using both SP 2010 and IP 2010

Ok, you use rules, not the default value, as pretty much every website I have looked for answer tells you...
Make sure the default value for the field you want to populate is blank, and then set a rule that when your lookup field value changes, it updates the value in your other field...
That was easier than I thought!

This is soemthing called a cascated drop down there are various examples of this on the web.
To do this you need to click on the drop down box that you want to filter.
This will be the duration. (The user would then select the course they went on)
In the duration drop down below you would ensure that you have connected it the correct data source.
Right click on the duraction drop down.
Drop down list properties
get choices from external data source
on the entries you would select the button to the right hand side
You would select 'course title now as this is what you want it to be filtered by' (drop down above)
When selected you would click filter data - (button on bottom right hand side)
You would then filter it so the formula is 'CourseTitle(above drop down) 'is equal to' CourseTitle(data source from the list)'
This then should only allow them to match select the time that matches that course.
If this doesnt work let me know.

Related

Are there any negative consequences of giving ‘Title’ field a default value of ‘View’ and making it a hidden field?

When I create a list, I have gotten into the habit of doing the following:
Change Title field name to Item
Give it the default value of View
Go to Advanced Settings
Allow management of content types > Yes
Click Save
Then in Settings, click on the Item type
Then click on the Item field and select Hidden
Then go back to Advanced Settings
Allow management of content types > No
Click Save
The result of this is that:
The Title field (now called Item) is hidden in the form
I have a column called Item, which has the link View in each row (which opens up the item)
I can’t remember why I started doing this (possibly one of the reasons outlined in this video), but the use case must have demanded it and I just kept doing it.
However, lately I have been having troubling thoughts about whether it negatively effects indexing or has any other undesired outcomes.
For example, I did a search in a list the other today, and in the drop down search results that were displayed, I just got multiple rows of the value View.
I also read just before posting this question that list items in the recycle bin will be identified by the value that was in the Title column. So if they all say View it will be impossible to differentiate one from the other.
So I just thought I would see if there is any authoritative, definitive best practice around the Title column, and ask if my convention is bad and if so what I should replace it with.
Thank You.
(Edit: I also hide the Title column in document libraries, as it doesn’t seem to serve a purpose, as clicking on the value in the Name column opens up the document anyway - therefore the ‘link’ action of the Title field is not required).

Multi Select List Box Document Property with Search bar enabled

I am working on Multi Select List Box document property with search field.
It works fine when I give any keyword like 'An' it gives me Andorra, Angola, Anguilla etc. I can multi-select all these 3 records and make my underlying data table filtered.
Now the challenge is, if I search for the records that starts with Z in the search bar and click Enter then the above selection is deselected/disappeared (meaning the last search elements alone will be available).
Any ideas on how to make the current selection and newly searched elements available ?
Any inputs and suggestions would be much helpful.
Attached the sample dxp file and screenshots.
I think the filtering you are doing is based on the document property attached to this multi select list box.
You can make another property and attach this value to that doc property, whenever somebody changes this value run an IronPython to append to that doc property.
Give a reset button to clear this value when required

Infopath and Cascading Dropdowns

I have a question for you bright minded souls. I have an Infopath form for a Sharepoint List (meaning that this is considered an Infopath List Form) that I would like certain behavior for... and I'm not quite sure how to achieve it.
The gist is, I have two dropdowns on the form and I want the second dropdown to change its values based on the first dropdowns selection.
Both are pointing at the same list. The list looks like so:
ID, ModuleName, SystemName, PayCode, LineOfBusoness
1, Mod1, Sys1, O, LOB1
2, Mod2, Sys2, O, LOB2
3, Mod3, Sys3, C, LOB3
4, Mod3, Sys4, O, LOB3
The first dropdown contains just the paycodes, so basically "O", and "C".
Now the second dropdown is where it gets tricky.
The second drop down is to display all the Lines of Business (LOB) from that list based on the PayCode selected in the previous dropdown. If they select "O" then just display all the LOBs that has the paycode of "O".
BUT... if they select "C"... well then there are also dropdowns on the form where they have already selected System and Module... so it would then take those values that were selected and choose the value in the list that has the System they chose, the Module they chose, and the Paycode they chose.
How can I do that? My first thought was well, just use code... but it turns out Infopath does not allow custom code on a "list form" which this is... wtf? So then the next option is to use the "cascading dropdown" approach whereby you can also use rules and filters to try and achieve this behavior.
Can that be done? What are your thoughts as to how you would tackle this problem?
Thanks in advance, and please let me know if you need additional information!
One way to do this is in the code behind.
Take the first drop down, find the field it is associated with, right click and create a "Changed" event.
In the code behind event, a Changed event will be created for that field. There you can grab the value of the currently selected item of the first drop down. Depending on that value, you can then modify the contents of the second drop down.
Do this by grabbing the original list, and running an SPQuery that selects all the items that have a "O" or "C" or whatever selected value is. You can also run a linq or foreach statement on all the list's items, whichever you prefer :)
Note: Make sure the drop down list control properties has "Always" selected in the Browser Forms tab of the properties (right click on the drop down list to access these properties)
Hope this helps!

Save Infopath form w. dynamicly created fields in Sharepoint 2010 Library

I am very new to Infopath, and need some architechtual guideslines. My scenario is as follows:
I have a Sharepoint list, let's say it contains beer, and three items of it: "Kronenbourg", "Corona", "Tuborg". "Beer" is a content type, derived from Item.
What I need to do :
I need to create a "dynamic" Infopath form, that presents the user with a CheckBox for each beer. If a new beer is added to the Beer list, a new Checkbox should show up on the form without intervention, even on saved instances of the form. I have not decided what should happen upon deletions.
I then need to save this infopath form, including the selections, in a sharepoint form library, so that the users can go back to one of maybe many beer-forms that they have saved, and maybe change the selections.
I also need to build a string from the selections at some point in time, and present this string in a visible column in the form library, but thats beyond the scope of this post.
What I managed to throw together so far:
I have a kind of working Infopath form. I have added a sharepoint dataconnection to the Beer list, and dragged a repeating table to the design area. This "works", i get a list of my list items. I then added dummy Y/N field to my beer content type, selected it in the fields, and now i get a neat checkbox next to my records.
Obviously this does not seem right. I do not need to save anything back to the Beer table, I only need to use the beer table for lookup, and keep the selected choices in the saved instance of the form.
Ok, thanks for staying with me so far. What do I do here, can Infopath be persuaded to support a scenario like this, or am I better off building custom webparts? I think my main questions are:
Can I maybe attach an "input-only" CheckBox to a repeating list/section ? (and how do I refer to such dynamically created control)
How do I make Infopath load the choices dynamicly from db, but save the data in the instance of the form?
Should, and can I maybe attach a content type to the form library, representing the choices and somehow attach that to the form?
Thanks for any input
If I understand your requirements, I think the thing to do here is to use a Multi-Selection list box (MSLB). This can have its values populated from a secondary data source (i.e. a list), and it would be bound to a repeating field that would automatically have values added and removed as values are selected and deselected.
As far as getting the selections into a single string, if you just want this value for a column of the form library that the forms will be submitted to, you can just use this repeating field as a promoted property, and use the "Aggregate" option to combine the values into one.
The other option would be to create a separate field to hold the string and use the "double eval trick" (please Google that) to combine the values into one. One gotcha here is that if you use double eval trick with a MSLB, you have to put the formula both in a rule on the MSLB's field, and in the default value formula for the target field.

table view sharepoint list

Need your inputs on below query-
after opening share point linked table in table view, fields section is grayed out for me..As mentioned in the below post, I want to set index on columns of sharepoint linked list ..How i can activate this section?
appreciate your inputs..
This is related to below post
Index on Sharepoint Linked table
Well, everything going to be greyed out if your cursor in the ID column since there nothing you can change in the required auto number ID column. If you move your cursor into other columns, then the options on the ribbon should un-grey and become enabled.
I suppose the above is a long shot and I assume you moved the cursor out of the ID column or at least clicked on the column you want to make changes to. So your picture as you show is correct since your cursor is placed in the ID column of which as noted you cannot change anything about that ID column anyway.

Resources