Sunday, November 18, 2007

Sharepoint 2007 Custom Field - Query Based Lookup

First off all, i would like to thank DataCog Guys to show newcomers (specifically in MOSS) like me that thing like this can be done in first place.
So this was my problem. i was into a sharepoint project that had requirements so funny that made me think twice as to why are these guys opting for sharepoint 07 in first place.Y cant they happily do it through a .net 2.0 custom web app.
Well, thats a different story all together.
In short, one of those funny requirements was to get highly filtered data in a dropdown based list column. The "out-of-the-box" Lookup column is a plain lookup thats simply gives all the values of a particular column of a particular List in your List(It does not even take care to display distinct values ... lol)
my requirements were way to much for this lookup guy to handle.Yes, we are talkin about full fledged query's here (like select [column] from [list] where [column1] = [value] and [column2] = [value] and [column3] <= [value]..... so on and on) We First thought that web parts are only bet in this case. When i found out this article of these Datacogs guys.(once again.. all hail DataCogs) However, even these guys are solving their own specific problem of cascading dropdowns. I feel, my requirement was far too generic then this and i m sure 100s and 1000s did faced it and are facing it still. My plans were, why not give people a full fledged query building interface wherin, they can put as many filtering criteria's as they wish..(like the one i pointed above) So this is what i came up with following the same idea of the that DataCogs article The Project is now moved to CodePlex
Sorry, i continued on his project and after every thing was done, i was too lazy to remove them. so just dont look at them, Unless, offcourse you are interested in cascading stuff.
By the way, the only beauty of his control is a simple 4 line method called
FindControlRecursive. Cool stuff!!!
Any ways, a Big Thanks to DHTML goodies guys for making my fancy balloon toolTip dream come true in this control
Hoping of a response for bugs or feature enhancement at
baig.adil@gmail.com

Tags: ,


108 comments:

biste said...

Thanks Adil, your cascading dropdown control works great and it is fine packaged and written.
Thanks for sharing it

Anonymous said...

I tried to install your solution, but I get the error message below. Please let me know if I need to make any other changes to the bat file besides the url.

Thank you,

Anonymous said...

I tried to install your solution, but I get the error message below. Please let me know if I need to make any other changes to the bat file besides the url.

Solution manifest for solution '6733c1f8-1873-4de2-8f49-2b7e38fd89f9' failed val
idation, file manifest.xml, line 28, character 26: The element 'RootFiles' in na
mespace 'http://schemas.microsoft.com/sharepoint/' cannot contain text. List of
possible elements expected: 'RootFile' in namespace 'http://schemas.microsoft.co
m/sharepoint/'.
Package\AGTech.Sharepoint.CustomFields.wsp: The Solution installation failed.

Adil A. Baig said...

Did you make any changes to the Manifest.xml file, cause dozens of people have installed it successfully without ne problem. Post me the content of your manifest. I Really cannot understand like this as to what 'Text' is it really referring to at the RootFiles node.

Anonymous said...

Hi,

Have you tried to go in Datasheet view mode?
The custom lookup column in rendered in readonly mode...
I have solved cascading dropdown problem but, seems that activex can't show correctly custom fields...

Adil A. Baig said...

yeah i know, even i m stuck on the same thing.

It seems that sharepoint uses different methods to get/set the values for its internal column then the one it exposes in SPFieldText.

Datasheet while rendering uses those method calls to get value. When it comes to our column, it tries to use the same method and rendering template but does not get it as i have not overridden it(for its not available to override), this is what an experienced sharepoint guy told me..
I really dont know as to how true is this. He says Microsoft's are workin on it. Its kinda bug

Adam said...

Adil,

I am trying to accomplish the following:

1. Choose a country
2. Choose a state or province (based on selection 1)
3. Choose a city (based on selection 2)

Is there a way for me to do this using your solution?

Adam

Adil A. Baig said...

i fear you cant do that with the existing controls.
parent child control (as the name suggest) has to server control tightly working together:
1. the parent
2. the child that get its data based on parent.

your case needs a third one ...the grand child!!!
simple solution.. make one.. or if you think this would get a whole lot of family of related controls out there, then i suggest you make a web part for your scenario

JoeB said...

Hi,

first of all I want to thank you, Adil, for sharing this excellent solution. You really did some great work!

Additionally I wanted to give a solution to the problem posted on Dec 5th:
I figured out the same error message when running "installwsp.bat". The solution is NOT to use the file from the "AGTech.Sharepoint.CustomFields"-project's root folder. The files located under "DeploymentFiles" are the working ones.

Joe

Adil A. Baig said...

oops!!..
sorry folks, for my haste is causing a lot of people to waste time on silly things.

plz dont use the install.wsp,uninstall.wsp,etc files lying in the root. use the ones in deployment files.

keson said...

Hi mate!
I am realy looking forward to test your solution, but I canget the proper archive. The only file listed in your esnips site does not contain any package or install bat file. any ideas? Thanks

Adil A. Baig said...

you would find it in "Deployment Files" folder located in:
"AGTech.Sharepoint.CustomFields" project

Anonymous said...

Thanks Adil, it works great. I have only one little problem. When I want to edit column with parent drop down list, I get the error message.
Miro H.

Anonymous said...

An "Unknown Error" occurs when you try to edit a column that is a "Parent".

It seems this error is reproduceable on different SP sites also.

Any idea's?

Adil A. Baig said...

first of all, see the stack trace of the error, "unkown error" is not gonna help you trace one, for which you have to enable callstack (callstack=true),enable debug (debug=true), and custom error switched off(customerrors mode=Off)
might be, try uninstalling the wsp, rebuilding the solution, recreating the wsp and reinstalling, there are certain things even i m clueless bout regarding the runtime behaviour of the control

Powell said...

Fantastic! I have been looking for how to do this for couple months. You could easily sell this. Thanks so much.

ROCK ON!

Adil A. Baig said...

thnx powell, if i can be of some use to the MS community(family i call it!!) thats enough for me.
Hope i get enough opportunity and exposure to carry on.

Milan Chauhan said...

Hello Adil,
I have create cascading drop down list control type for rendering country and state. On basis of value in country drop down, child drop down will render. It is working fine. But when it is switched into "DataSheetView" fields turn into read only. So what would be the problem in it. !!!

JD said...

Adil,

This is a great tool...one of the better solutions I have found for working with list features.

I have on question. Do you think or have any recommendations for how this could be modified to query lists located within subsites or workspaces of a site collection?

I noticed that the query builder gives a "Cannot complete this action" error if you try to load a subsite URL.

Great work.

Thanks

Adil A. Baig said...

simple... load the lists from the subsites or whichever specific site you want during load time.. when FieldEditControl loads (the edit user control)
if it gives.. cannot complete this action.. means the user trying to use it does not have necceasry permission might be.. or just debug it and see...its definitely catching the exception somewhere and displaying it in the textbox. just see where

and you may also want to wrap the block in: ..SPSecurity.RunWIthElevatedPrivilidges() delegate
to see if the permision is not the thing casuing this exception.

JD said...

Adil,

Thanks for the reply. One more snippet to narrow this down. It will load the List names from the subsites, but when it throws the error when trying to access the columns from one of the subsite lists.

"Cannot complete action. Please try again."

The results are the same when running on two different WSS environments as the Site Collection Administrator.

I am a bit of a newbie when it comes to programming in the WSS/SP environment, so can you help me out by helping me pinpoint where in the code to make the security change? Your solution meets all of my requirements except the requirement to access all lists in the site collection, including subsites/workspaces.

Is it in LoadListColumnsInDropDowns?

Thanks so much for your time and effort...

Adil A. Baig said...

No..not in LoadListCOlumnsInDropDown()..
i guess it should be in LoadLookUpListsInDropDown()..
however.. to pin down on the exception..simple thing.. y dont you debug the solution..
simple..rebuild the solution..put the dll in GAC. and reset IIS.. (thats not someething specific to sharepoint i guess)

A Seeker! said...

Thanks for the great control Adil.
I could successfully deploy it on my site and it correctly pulls all the lists created by WSS itself. However I am not able to see any custom lists that I have created.
Do I need to do anything specific to load custom lists in 'List Name' dropdown?
Please let me know...

Adil A. Baig said...

What???
And it is supposed to pull custom lists created by used only.. not the hidden lists found in WSS.

I dont know y is it not pulling your custom list data? You're the first one reporting that.

All i would say is, try debugging and see whats going on

A Seeker! said...

Ohh.. found the problem.
URL was not pointing to the subsite where I created the custom-lists.

Now I have created a column using the Parent Dropdown List control. However after creating this column I can not create a new item in the list.
I get "An unknown error occured" error.

To verify, I deleted this newly created column and was able to create the list item successfully

Any guesses why this is happening?

Adil A. Baig said...

first of all, "Unknown error occured" wont take any developer anywhere in solving his problem in sharepoint.

answer is simple, know what the problem is. see the stack trace.. set customerrors=Off and callstack=true in web.config
this will take off the beautifull "Unkown error occured" and get you your ASP.NET yellow screen of death.
follow the screen

jseyfried said...

hey,

can some just help me out with howto see ANYTHING of this solution after deploying it?
what elements will appear (maybe i have just been looking right through it... *err*)

please help,
johannes

Adil A. Baig said...

Then i guess.. you should first take a lesson of what a custom field control is in sharepoint

Anonymous said...

Hi all,

Great code!!! We get an error emssage when we try to access to a list element properties. Any ideas??

Carles

Server Error in '/' Application.
--------------------------------------------------------------------------------

Al menos uno de los tipos de campo no se ha instalado correctamente. Vaya a la página de configuración de la lista para eliminar estos campos.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Al menos uno de los tipos de campo no se ha instalado correctamente. Vaya a la página de configuración de la lista para eliminar estos campos.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[COMException (0x81020014): Al menos uno de los tipos de campo no se ha instalado correctamente. Vaya a la página de configuración de la lista para eliminar estos campos.]
Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback(String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pSchemaCallback) +0
Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pSchemaCallback) +265

[SPException: Al menos uno de los tipos de campo no se ha instalado correctamente. Vaya a la página de configuración de la lista para eliminar estos campos.]
Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pSchemaCallback) +395
Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() +2191
Microsoft.SharePoint.SPListItemCollection.GetDataTable() +262
DataCogs.WebControls.ChildDropDownListFieldControl.SetDataSource(String parentSelectedValue) +768
System.Web.UI.Control.EnsureChildControls() +149
Microsoft.SharePoint.WebControls.BaseFieldControl.OnLoad(EventArgs e) +216
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2604




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

Adil A. Baig said...

hello sir,
plz translate this in english.. me no james bond to understand that..
all i can tell is its coming somewhere at loadcontrolresursive()..nothing more than that...

Anonymous said...

Hi Adil,

Sorry!!! I attach the translation

[SPException: Al menos uno de los tipos de campo no se ha instalado correctamente. Vaya a la página de configuración de la lista para eliminar estos campos.]

"At least one of the field types has not been installed correctly. Go to the list configuration to eliminate these fields."

Thanks in advance

Carles

Adil A. Baig said...

its as easy as it reads... field type is not installed correctly...try running install.bat again with the site url

Anonymous said...

Where can I find the package & instructions for this? It is exactly what I am trying to do for a SP lookup with user, phone, email address. I need it to be simple since I am new to designing SP sites.

Adil A. Baig said...

The Documentation is in the release .. i am sorry.. i will put it separately as a File in Documentation category.

Harmen said...

Hi Adil,

great piece of work, thanks.
One question: Once I've successfuly selected a value from a different list in a lookup field, and the original value changes, will the value in the lookup field be automatically updated?
Thanks, Harmen

Adil A. Baig said...

Obviously.. it gets data during Load time of the control. it is not some precaching of value. All i do is, save the CAML query, site name, listname, and run the CAML on that list in load event.

Nicolás Briones said...

Hi Adil...

Great work and great coding!...

I'm implementing grandchild level, and then try to solve a tiny problem (at least for me).

When you create an element on the list, if the original source changes, the element that you recently created remains the same. I suppose because when you create a new element, it's a copy from the original source, and not a link to it (am i right?).

Any ideas to solve this?

Regards,

Adil A. Baig said...

I....well...mmmm... dont think it creates a local copy of element.. it is always Querying the referenced list at the controls Load time and getting data on the fly..

Nicolás Briones said...

Sorry if i don't make myself clear...

The control always load the values on the fly. The problem is the elements that you already created. They remains the same, even if you modify the source value.

Adil A. Baig said...

So let me see..
yer saying, that even if you change the fields' meta data and point it to some different List, still they load thee values to the older reference??..
is this what you meant..and clarify more on term "Element" that we're referring here.. Are we talking about fields meta data on the Edit page, like parent list, site, join on column, etc...or fields' instance on the new form page.

Alexander Bautz said...

Hi,
The Query Lookup is very nice, but i have one question/request:
Is it possible to have the ability to dynamically get values from the sharepoint user profile (WSS 3.0 - Welcome -> My Settings) for CurrentUser in the "Third tiny dropdown" for example from the Department field?

Keep up the good work!

Regards
Alexander

Adil A. Baig said...

every thing is possible..y not??.. only if i knew the object model to do that.. but there has to be some way.. but i, as of now, dont know how

Alexander said...

OK - thanks anyway

Regards
Alexander

slisse said...

hello,

I'm always getting the forllowing error in Site URL :Cannot complete this action.Please try again.
when choosing a list name:

I'm using WSS 3.0.

what can be the problem / solution for this,

thanks

Nicolás Briones said...

Hi... just to complement slisse comment...

I have the same problem, and i noticed it happens when you try to use a list in some parent site (maybe a permission problem?). If the list is in the same site, it works fine. Extrangely enough, you don't have the same problem with parent-child object. When you select a list on the parent site, you will not see the error.

Alexander said...

Hello again,
I have tried to add the Parent/Child control to a site, do a stsadm -o backup of the site collection and restoring to another url. What happends is that the Parent control will point to the old url. I have not managed to "re-map it".

Is there a workaround other than deleting the field and readding it?

Regards,
Alexander

Adil A. Baig said...

not deleting the control!!!.. just changing the elements (meta data) in field edit. So lets say: if i create a field with value of reference site like : http://server1:8080 and restored on production say:
http://server2:9000 what in the world will automatically change the pointers to newer server??
something you have to do..
but not deleting the field.. certainly not

Joe O said...

Hello Adil,
Thanks for taking the time to improve on such a sort after feature that one would expect MS to make a standard!
My question is this, after a successful install of the Datacog controls, I found that while editing a documents properties within the browser everthing worked fine, but when I create a new document (Office 2003) and populate the metadata within the DIP form ready for saving, the new drop downs are not available. Will your developments allow the drop downs to render correctly in the office environment?

Cheers,
Joe O

Adil A. Baig said...

Office client integration!!
interesting.. not tried..and have no clue..if data cogs dint rendered.. then i dont think mine can either!!
i think its gotta do with the way the fields are made..
i mean... i dont think mine is the perfect custom field control in the world.. i or datacogs guys might have not overriden and implemented required methods to do that..

Amit said...

I have 2 list
a) Types (Column - types)
b) Causes (Column - types and causes)

The causes list is related to the types list using the columns types

I have a bugs database. This i obtained directly from Microsoft site. In this list, i add 2 more columns 1) types 2) Causes

for this database -

My intention is to show only those values in drop down for the causes column which are mapped to the value in the types field

PJ said...

Hi Adil,

I had this requirement. Please let me know if your codeplex project will help me.

I have "DepartmentName" as a lookup column where user can select more than one department. Currently this is a static list. I want this department data to come from SQL table and user should be able to select one or more departments.

Then for all the departments they selected, I need to show in the next list list of all employees matching those departments selected. Here one or more employees would be selected.

Please suggest me if this is possible or any other suggestions for this problem.

thanks

Adil A. Baig said...

The Cascading dropdown solution do exactly the same, but not with SQL custom table. It expects the data from custom list. You can very well see that in the field creation/edit page
If you want from custom SQL table of ,say, some partners' application, why don't you go for BDC object model??

Alexander said...

Hi again Adil,
I refer to my previous comment:

Hi,
The Query Lookup is very nice, but i have one question/request:
Is it possible to have the ability to dynamically get values from the sharepoint user profile (WSS 3.0 - Welcome -> My Settings) for CurrentUser in the "Third tiny dropdown" for example from the Department field?

***************

I have developed a simple "CurrentUserFilter" for WSS 3.0 that reads the Department field of the current logged in user and passes it to connected webparts on page load. i was thinking of your Query-lookup and thought that it would be absolutly fantastic if it could filter based on curren user.

Is there any possibility that i could trick you into implementing this in your already brilliant solution?

Here is the code that reads the department from current user:
# Code:
string siteUrl = SPContext.Current.Site.Url;
string webUrl = SPContext.Current.Site.RootWeb.Name;
SPUser currentUser = SPContext.Current.Web.CurrentUser;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb(webUrl))
{
try
{
Microsoft.SharePoint.SPList list = site.RootWeb.Lists["User Information List"];
Microsoft.SharePoint.SPListItem currentItem = list.Items.GetItemById(currentUser.ID);
department = currentItem["Department"].ToString();
}
catch (NullReferenceException)
{
department = "";
}
}
}
});

I run with elevated privileges because only sitecollection administrators can acces this list.

Regards
Alexander

Anonymous said...

Awesome, job it works great. I was wondering if it's possible to have the value link back to the list item itself. I believe this is how standard lookup columns function.
I am using the dropdown to filter out people from a custom list based on a category type; however, I need to be able to click their name and take them to the list item.

If you have any ideas on how to accomplish that, please help.

Thanks so much!

Anonymous said...

Hi Adil great job
can you suggest me in creating the grand child.
Hi Nicolas I am having the problem in creating the grand child requirement i read you are also into the same problem do you made any workout, if so could you please share that. thanks

Zdeněk said...

Hi,

I tired your solution on SharePoint server with mixed authentication. Persons from intranet zone with windows based authentication works fine. But users with access from extranet zone with form based authentication get error, when they create new item in list with query based lookup field. Error message is “User not found”. Source and destination lists are on same web where users have Contributor role. Users have read access on all site collection. Authentication provider for extranet zone is ADAM. Any ideas?

Zdenek

Adil A. Baig said...

The code dealing with authentication in the field render control is not much of a rocket science.
It can be easily tailored for forms auth!!

Anonymous said...

Adil,

I am trying to accomplish the following:

1. Choose a city
2. Choose a street (based on selection 1)
3. Choose anoter street(based on selection 1)

A parent multiple child solution!

Is there a way for me to do this using your solution?

Thanks in advance

Anonymous said...

Adil,

thank you for this nice tool, i have problems to create more as one parent - child relationship in the same list, only the first works fine the second dosnt work, if i select in the second ralationship an parent value, the child value of the first is also emty. could you help me please in this one?

Thanks
Kind Regards
Markus

Gene said...

Adil
Thanks for the control !

I've created a list (of persons) width a (query)lookup field and now I want to import al lot of users (>1000). I noticed that the custom field is readonly. How can I import my data?

Adil A. Baig said...

actually,
i really dint get what you wanna do here with custom field.. and how import is coming in all this??!!!

Rocky said...

Adil,

This control is fantastic, but I'm having difficulty following the example in the documentation. Please look at the example I describe below and tell me if I am misunderstanding the correct use for this tool.

I've created a custom list with two "Choice" columns: View1 and View2. These are my parent and child columns and each item in the list can have only one value for each column. View1 has the following available choices: A, B, C and D. View2 has the numbers one through twenty as available choices. I have populated the custom list with several entries. For example, Item1 in my list has a value of "A" for View1 and "1" for View2. Item2 in my list has the value "B" for View1 and "6" for View2.

In another list, I've created a "Lookup (Query Based Filtering)" column. I input the custom list created above as my List Name. The Display Column of LookUp Dropdown and the Value column of LookUp DropDown are set to View2. The Column to filter LookUp on is set to View1.

So far, my query is:
WHERE View1 = A

How do I configure my query so that values 1-5 are shown when A is selected and values 6-10 are shown when B is selected, etc.

Thanks for all your time and effort

-Rocky

Adil A. Baig said...

first of all, the thing here you want to do is something that can be done by parent-child cascading guys.. and not query based lookup filtering control.
so you want 1-5 when A is selected and 6-10 when B is selected.
Simple create a list.(purpose of this list would only b to hold the Items be coming in drop-down.)
lets say list is "testList"... (you name it what you like.. what the heck!!).. let say.. this "testList" have 2 simple single line of text columns... say.."Column1" and "Column2"

put 10 entries in "testList" with folowing values:

column1 column2
A 1
A 2
A 3
A 4
A 5
B 6
B 7
B 8
B 9
B 10

Now coming to your desired List:
make a parent field.. on "column1" of "testList"
make a child field on "column2" of "testList" and Join column be "column1"

there you go!!

Pankaj said...

One thing is sure...
this guy Adil is really smart...!!!

Good work Adil.

Iskander said...

Hi Adil
Thanks for your solution. It´s nice and it works really great in my site.
Anyway I´m trying to add the field to a Content Type in Document library and sharepoint shows an alert saying that is not compatible with programs for editing documents. Is there anything I can do?

Adil A. Baig said...

apart from message, anything more??
or is it that it does'nt let the field to be added to the content type in the first place.

Iskander said...

Yes I can add the field to the content although receiving the alert message "this columns are not compatible with programs for editing documents" type. But then when I open a document the field don´t show me the values inside

thanks a lot

Adil A. Baig said...

actually, never tried adding this guy in a content type..good finding though..if i get time, given my project deadlines, will try lookin into this thing

Iskander said...

thank you very much for your help and for sharing this solution

Warren said...

Hi Adil,

Awesome work! But, i cant actually get this thing installed :-(

Im using MOSS 2007 and trying to install the control using the setup.exe

When it asks me to select a site, it only shows me the following options to select:

http://genserv007-01:15204 (Central Aministration)
http://genserv007-01/ (Default Web Site)

I select "", but then get the following error. I know my site is located at "http://genserv007-01/sites/Gencentric".

***** SOLUTION DEPLOYMENT *****
***** ERROR *****
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.
CodePlex.SharePointInstaller.InstallException: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications. ---> Microsoft.SharePoint.SPException: This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.
at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.CheckDeployParameters(Collection`1 collWebApps, Boolean globalInstallWPPackDlls, Boolean force)
at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.CreateSolutionDeployTimerJob(DateTime dt, Collection`1 webApplications, SPSolutionDeploymentJobType jobType, Boolean globalInstallDlls, Boolean force)
at Microsoft.SharePoint.Administration.SPSolutionLanguagePack.Deploy(DateTime dt, Boolean globalInstallWPPackDlls, Boolean force)
at Microsoft.SharePoint.Administration.SPSolution.Deploy(DateTime dt, Boolean globalInstallWPPackDlls, Boolean force)
at CodePlex.SharePointInstaller.InstallProcessControl.CreateDeploymentJobCommand.Execute()
--- End of inner exception stack trace ---
at CodePlex.SharePointInstaller.InstallProcessControl.CreateDeploymentJobCommand.Execute()
at CodePlex.SharePointInstaller.InstallProcessControl.TimerEventInstall(Object myObject, EventArgs myEventArgs)

Warren said...

Sorry, forgot to put in what i selected on teh "Select Site" part, i always select "http://genserv007-01/ (Default Web Site)"

But my site is as http://genserv007-01/sites/Gencentric

Adil A. Baig said...

the sharepoint setup installer itself is a open source project downloadable from codeplex itself. So if somethings going wrong in that setup, (And it does sometimes), try using the normal stsadm way of deploymentr on the wsp package.
see if it works...

Warren said...

Hi Adil,

Thanks, got it working.

Another question, when using "Lookup (Query Based)" is it possible to not include server name when inputting Site URL? The reason i ask, is if i backup the site and restore teh site to a new server, the servername will have changed and i will have to manually go through all my lists to update the servername :-(

A cheeky question...can we have the source code? ;-) Reason, so that i can tinker a bit and change it to not make servername mandatory. So instead of

"http://genserv007-01/sites/Gencentric/ClientA/ProjectX/"

I can have

"/sites/Gencentric/ClientA/ProjectX/"

Anyway, awesome custom field. Thanks!

Adil A. Baig said...

its on codeplex,
source code??
hello??

Warren said...

Geez, sorry friend, new to codeplex ;-)

Adil A. Baig said...

ne ways,
nothing great in the code. one of the first few custom fields to be made public i can say that for sure.
lot of guys after that have done better work in custom fields.

Tobias said...

Hi Adil,

First of all, like everbody else, I'd like to thank you for creating this control.

I've seen 1 person before me ask this (he didn't receive an answer) but is it possible to make the parent en child columns clickable back to the selected list item?

Any help is appreciated,

Tobias

Anonymous said...

Can the [value] in the Query Based Lookup Field be based on the current value of a field in the current record? How would it be refernced [Department]?

Sophokles said...

Hi,

I'm trying to use the parent-child control.
I created a custom list with a parent and a child and everything was ok.
then I tried to create another parent type column (my objective is to create a grand child column) and since then when i lcick on the column to see its properties i get the following error

Cannot have multiple items selected in a DropDownList. at System.Web.UI.WebControls.DropDownList.VerifyMultiSelect()
at System.Web.UI.WebControls.ListControl.RenderContents(HtmlTextWriter writer)
at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Control.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at ASP._controltemplates_inputformcontrol_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\InputFormControl.ascx:line 15 etc... (th error goes on, if you want the whole text i can post it to you)

My problem is that cannot even delete the column.

Is there something i can do?

Regards

Jamil said...

Hi,
I am trying to install latest version from codeplex.com it gives me error that "This solutions contains some resouces scoped for a Web Application and must be deployed to one or more Web applications."

Durring installation I select my site "http://abc:1234/" where I want to install this solution.

Please help me how can i fix this issue.


Thanks!
JAMIL

Adil A. Baig said...

there was must be some screwup related to the solution installer.. just trying installing the wsp with the stsadm.exe installsolution and deploysolution commands

Jamil said...

Hi,
Is that cross site query based lookup. I installed that and trying to load list from other site but not working while to load same site list it works.

I think it needs to be modified.

Regards,
JAMIL

Simon said...

Hi Adil,
Trying to install your neato gadget.
Install starts, confirms there is a Windows Sharepoint 3.0, then fails. "Sharepoint was unable to connect to the database server".
I can't find anywhere this is configured, nor do I know what this means.
Can you advise? (I do have lots of rights, but it's possible I'm missing something).

Simon

Adil A. Baig said...

hey,
this has got something to do with your server infrastructure and security settings. cannot connect to database, what so tough in that error??
check the protocals on database server. ask the database people if both TCP/Ip and named pipes are enalbed for remote connections

Anonymous said...

How can I get this to work with Word 2007? Can someone help?

Please Help!!!!!! said...

We have a small problem when we use cascadign drop-downs. the value stored in the database is stored country;country instead of just country. and region;region instead of just region. We are probably doing something wrong but we dont know what. can someone please help.

Adil A. Baig said...

database? what database? you mean the field value in sharepoint is retrieved through object model in this format?

Please Help!!!!!! said...

Yes, by database i mean what you have said.

Please Help!!!!! said...

Just a quick background, the current version of the solution that we have stores KEY;VALUE pair where as the previous version stores only KEY. Just because of this limitation we are unable to set up those columns are managed properties since the values returned in XML Data set also includes KEY;VALUE and it is directly consumed by faceted search web parts.

Anonymous said...

Hi Adil,

DId u get any solution for rendering custom field types in data sheet view.

Thanks
Raj

gvijaikumar said...

Hi Adil,

I want two pairs of cascading drop downs in one newform
one pair is of country and state
and other is of category and question, right now for me the two pairs are not working simultaneously, if I delete one pair another one is working without any problem, please help, how put two pairs in one newform of a list

Thanks for your extreme support

Adil A. Baig said...

I did'nt designed these the solution for this. if you want to cater such a requirement, it's simple.
customize my source code, what else??

Anonymous said...

this web part is most usefull in what im doing right now

what suprises me is that the lookup value can be calculated by calculated columns which lacks in OOB lookups

just wondering if its intentional or just by accident?

im never using OOB lookup again

Astak said...

Hi Adil,

Thank you for the nice control.I am testing your "Query Based LookUp Filtering" field control and I very impressed to say the least.
My question is regarding the bug you mentioned in your pdf guideline(i.e. #1 which talks about not using the Title column in the CAML query...).

I tested it and it seems to work for me and I was wondering if the guideline is not revised or I am not understanding your point. What I did was, I used the TITLE of my parent List in my filter. As a result when I put my cursor on the view query link I see such a CAML query in your beautiful pop up baloon. And it says "Where LinkTitle=the Value I used to filter LookUp On". Are you saying this should have given me an exception?

Thanks

ramesh said...

hi adil,

i would like to customize the cascadedropdown code from the source code which you have provided..
i just build that code as WSP builder setup and installed on the site.
when i press ok button, after filling all the values iam getting following exception.

Field type CascadingDropDownListField is not installed properly. Go to the list settings page to delete this field. at Microsoft.SharePoint.SPFieldCollection.CreateNewField(String typeName, String displayName)

Please help me..

Gregory said...

I have the same error

Go back to site
Error




when i add the column to my list & try to edit / add new ..i get


An unexpected error has occurred.
Troubleshoot issues with Windows SharePoint Services.






when i add the control to my list and try to addnew / edit it gives :

An unexpected error has occurred.
Troubleshoot issues with Windows SharePoint Services.

Go back to site
Error




when i add the column to my list & try to edit / add new ..i get


An unexpected error has occurred.
Troubleshoot issues with Windows SharePoint Services.






when i add the control to my list and try to addnew / edit it gives :

An unexpected error has occurred.
Troubleshoot issues with Windows SharePoint Services.

any suggestions?

Gregory Mitt

Anonymous said...

Deployment of the Query Based Lookup solution not only renders affected columns in Datasheet view as read-only but disables (breaks) the Task Pane in this view. Is there any hope for a solution to this problem?

Thanks.

vinhl98 said...

seem like this only can do one query lookup. I set the first query working fine (2 lists P / C) but when I tried to set a seconde query lookup for another set of P / C list, then both query failed. is that the limitation or i just don't know how.. can you explain?

Adil A. Baig said...

I am sure there is nothing from control's side that would hinder two instances to run on a form.
i also remember using more then 3 of them on one page long time back.
Ne ways, need to look into this to conclude.
Why dont you debug and see what's going wrong.
as simple as that!!

Swanl98 said...

Thanks for your advice and sharing this solution.
I will start diggin

Jezza said...

I got the same error as Warren. "This solution contains resources scoped for a Web application and must be deployed to one or more Web application"

To resolve this I ran these commands from BIN stsadm location:

stsadm -o deletesolution -name "CoolStuffs.Sharepoint.CustomFields.wsp"

stsadm -o addsolution -filename "C:\temp\webparts\CustomFieldControls\CoolStuffs.Sharepoint.CustomFields.wsp"

stsadm -o deploysolution -name "CoolStuffs.Sharepoint.CustomFields.wsp" -url "http://myservername" -immediate -allowgacdeployment

Jameel said...

Hi Adil,

The solution given by you is amazing.

As per my understanding i should have a Parent DDL and Child DDL created from your solution to actually auto populate on selected in parent DDL

My Requirement is: example: List1
Col1 Col2(Choice)
Cricket England
Foot Ball India
Tennis US

List2:
I have Lookup field of Col1 in List1(already existing and i cannot change this Lookup field to Parent DDL) and i want to autopopulate another column with values of Col2 in List1

How to do this...please help me on this

Thanks in advance

Jameel

yatin m said...

Please confirm. Can we deploy this functionality with WSS 3.0 where we have not installed MOSS

Chuck said...
This comment has been removed by the author.
Anonymous said...

Hi Thanks for the great post.

We have a simillar kind of request and are requested to extend the solution to multiples Parent/Child lookup relation.

Any help would be useful.

Thanks
gary

Anonymous said...

any chance you've put together a solution for the grand child? or has anyone for that matter, and could you share the solution?

Anonymous said...

Does this work in Foundation Services 2010?

pdf digital signature said...

A special thanks for this informative post. I definitely learned new stuff here I wasn't aware of !