Automatically populate custom list column with site name when list is created

Hi All,
I am using a CQWP to display selected contacts on subsites from one master contact list on the parent site. Each subsite is for a different project and is named according to the project number. In the master contact list I have a custom column called Projects
that is populated with the various different project numbers that an individual contact is involved with.
The CQWP on the subsite filters the results based on the Projects column of the master contact list. As it stands I have to manually input this job number into the CQWP's properties. What I would like to happen is for the project number (the subsite name)
to automatically be input to the filter value.
The closet I have come to reaching my desired behaviour is by adding a column to the Site Pages list called Title and setting the filter value to [PageFieldValue:Title]. This still doesn't get the automatic behaviour I require because I still have to input
the project number into the Title column manually, but it is quicker than editing the CQWP properties.
What I need to achieve is either a way of automatically populating this column with the subsite name or find a way for the CQWP to pick up the subsite name and filter its results accordingly.
I have found this article http://www.andrewconnell.com/blog/Subclassing-the-Content-Query-Web-Part-Adding-Dynamic-Filtering which seems to be along the lines of what I want to achieve, but it is by no means a walk through and while I'm not completely
unfamiliar with coding, I don't know enough to implement it without help.
Any help would be greatly appreciated, I've been working on this for weeks on and off!
Thanks in advance,
Dan

Hi,
I believe the "Description" field type is Multiple Lines of Text. Sorting doesn't allow in this field type. In order to do the sorting, you would require to create additional column like single line of text column (note that it supports only 255
chars and require to truncate the data if more than 255) and update the data using event receiver or workflow. and do the sorting with that column.
kmhsad

Similar Messages

  • SharePoint 2013 Custom Content Type with Site Column custom validations

    Hello,
    Can somebody please suggest me how I can create custom content type with site columns with custom validation to site columns programmatically?
    Thanks,
    Praveen Kumar Padmakaran

    Hi,
    From your description, my understanding is that you want to create content type with site column with validation.
    You could create a site column, and add some validation to the site column. After you could create a custom content type, please add the site column with validation to the content type. Please refer
    to this code below:
    static void Main(string[] args)
    // replace your url
    using (SPSite site = new SPSite("http://sp/sites/sp2013"))
    using (SPWeb web = site.OpenWeb())
    //define the type of the field
    SPFieldType type = SPFieldType.Number;
    // create a site column
    SPField field = CreateSiteColumn(web, "newTest", type, "");
    // add custom formula for the field
    SPFieldNumber fieldNumber = web.Fields.GetField("newTest") as SPFieldNumber;
    fieldNumber.ValidationFormula = "=[newTest]>5";
    fieldNumber.ValidationMessage = ">5";
    fieldNumber.Update();
    SPContentTypeId parentItemCTypeId = web.ContentTypes[0].Id;
    // create custom content type
    SPContentType contentType = CreateSiteContentType(web, "newContent", parentItemCTypeId, "Custom Content Types");
    // add the site column to the content type
    AddFieldToContentType(web, contentType, field);
    // add fiedl to contenttype
    public static void AddFieldToContentType(SPWeb web, SPContentType contentType, SPField field)
    if (contentType == null) return;
    if (contentType.Fields.ContainsField(field.Title)) return;
    SPFieldLink fieldLink = new SPFieldLink(field);
    contentType.FieldLinks.Add(fieldLink);
    contentType.Update();
    // create a custom content type
    public static SPContentType CreateSiteContentType(SPWeb web, string contentTypeName,SPContentTypeId parentItemCTypeId, string group)
    if (web.AvailableContentTypes[contentTypeName] == null)
    SPContentType itemCType = web.AvailableContentTypes[parentItemCTypeId];
    SPContentType contentType =
    new SPContentType(itemCType, web.ContentTypes, contentTypeName) { Group = @group };
    web.ContentTypes.Add(contentType);
    contentType.Update();
    return contentType;
    return web.ContentTypes[contentTypeName];
    // create a site column
    public static SPField CreateSiteColumn(SPWeb web, string displayName,SPFieldType fieldType, string groupDescriptor)
    if (!web.Fields.ContainsField(displayName))
    string fieldName = web.Fields.Add(displayName, fieldType, false);
    SPField field = web.Fields.GetFieldByInternalName(fieldName);
    field.Group = groupDescriptor;
    field.Update();
    return field;
    return web.Fields[displayName];
    You could refer to these articles:
    C# code to create Site Column, Content Type, and add fields to Content Type
    http://spshare.blogspot.jp/2013/10/c-code-to-create-site-column-content.html
    How to do custom validation for site column in SharePoint
    http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-do-custom-validation-for-site-column-in-sharepoint/
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected].

  • I have a one-column table in pages.  Each cell has text and a number separated by a colon.  Can I automatically make it two column with everything to the right of the colon in the second column?

    I have a one-column table in pages.  Each cell has text and a number separated by a colon.  Can I automatically make it two column with everything to the right of the colon in the second column?

    Here's another way that is pretty quick to do.
    Formula in Column B is:
    =LEFT(A, FIND(":", A))
    Formula in Column C is:
    =RIGHT(A, LEN(A)-FIND(":", A))
    You can eliminate the colon from the result in column B by writing:
    =LEFT(A, FIND(":", A)-1)
    Once you do the conversion, you should freeze the result by Selecting columns B and C and then Command-C, Edit > Paste Values.
    Regards,
    Jerry

  • Separator page prints out with wrong name when printing from Outlook 2010

    Working with Windows 7 Enterprise, Outlook 2010.  We've set up our desk printers to print a separator page with the user's name, as several people use the same printers in our building.  Printing from IE, Word, etc. all work fine, and it'll print
    out the correct username on the separator page.
    When anyone attempts to print an Outlook email, it instead prints out my username.  We've found that it doesn't happen if they click on the "quick print" button, but it happens every time if they do "file > Print" or Ctrl+P.

    Hi
    As per the information and details provided by you that separator page prints out with wrong name when printing from Outlook 2010, please follow these steps: -
    To create a custom separator page file, use a text editor such as
    Notepad. On the very first line, type one single character, and then press
    Enter. The character on this line defines the character used as an escape character. For example, the following list assumes that this character is the at sign (@).
    Enter the escape codes for the functions you want, and then save the file with an .sep extension in the Windows System32 subfolder.
    In the Print Manager, select the printer that you want to use the separator page file with, and then click
    Choose Properties on the Printer menu.
    Click
    Details, specify the name of the desired separator page file in the
    Separator File box, and then click OK.
    Note:
    Put the custom separator page file in one of the following locations:
    In the %Windir%System32 folder.
    In a folder whose path contains a SepFiles folder. For example:
    Drive:\Folder\SepFiles\Subfolder
    I hope this information will be helpful for you.
    Thanks and regards
    Shweta@G 

  • I want to see a number with the name when one of my contacts calling me.., i just see his name...i am from egypt there is a problem with a country

    i want to see a number with the name when one of my contacts calling me.., i just see his name...i am from egypt there is a problem with a country

    If someone who is listed in your contacts calls you, you will only see their name. This has nothing to do with the fact you're in Egypt. The only workaround I can see for this is to put the person's number in the name section of the contacts. In other words, put their first and last name in the first name section and their phone number in the last name section.

  • User message entered in Validation settings does not show up in custom list form created in sharepoint designer 2010

    I have a custom list form created in SPD based on EditItem form.  I then set field validation in Validation setting and entered a user message to display when the validation did not pass.
    The validation works in the custom form but the user message never show up.
    I see a similar question posted in 2012:  
    https://social.technet.microsoft.com/Forums/en-US/cd292b50-856f-4dfa-8cfe-aeb688ee7185/validating-fields-on-a-sharepoint-2010-custom-list-form?forum=sharepointgeneralprevious 
    Is this still a known bug?   What is the easiest workaround?

    Hi ,
    From the
    above link you mentioned, have you tried using the code line in your custom form?
    Please try the code suggested by sp-achiever and hamish, and see if it could help solve the issue.
    <SharePoint:ItemValidationFailedMessage ControlMode="New" runat="server" ID="checkform" />
    Have you installed hotfix KB245789 or CU contained this kb?
    Please check if KB245789 has fixed this issue as KP2011 suggested in the same post, and please try it in a test environment firstly.
    http://support.microsoft.com/kb/2405789
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • New Column Still Defaulting To Value From Deleted Column With Same Name

    This is strange. I had a managed metadata column called "Document Category" attached to multiple content types and set to a default value (different in each library). Then I deleted the column (all instances from libraries and references from
    content types as well), and created a new site column with the same name, but a Choice field instead. The libraries that had a default value for the original column, are still populating new documents using the original default value, and it's showing up as
    something like 88;#Hospital Correspondence|4b1e8da6-8653-492a-3e45e6c56c38 . The column is still a choice field, so I don't even know why it allows this value. Does anyone know why this is happening or how to fix it?

    Hi  Vince,
    Thank you very much for sharing your solution here. It  would be helpful for others who encounter similar issue.
    Thanks again,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Eric Tao
    TechNet Community Support

  • Column with hide checked when I don't want it to be.

    I have a subject area when I add a column, it has the hide check box checked. If I uncheck it , it still will have it checked when I go back in to it. They happen to be date fields in a materialized view. The columns will not show when the results tab is selected. I do not find nay errors in the nqquery.log or nqserver.log. Any ideas?
    I still suspect it has something to so with the data type. A select from the view in sql looks fine.

    Hi,
    Steps to implements,
    "The columns will not show when the results tab is selected. I do not find nay errors in the nqquery.log or nqserver.log. Any ideas?"
    1) for the above issues, its know bug and its fixed in obiee11.1.1.6.0 make sure your version.
    FYI:bug ref
    13580620 COLUMNS ADDED IN THE CRITERIA TAB ARE AUTOMATICALLY ADDED TO ALL EXISTING VIEWS
    2) by workaroun way in obiee11.1.1.5.0 and 11.1.1.3.0 version --> remove the existing view and re-create the view it will bring up newly added coulmn. otherwise when ever you just want to add new columns in your exsiting analysis view just edit and go to the result tab and you can find the required SA presentaion table columns in left side -->select it required columns and double click it then its will get displayed in result view.
    Thanks
    Deva

  • How to have digital signature in a Sharepoint 2013 custom list form created in InfoPath 2013?

    I have a requirement that they want a form in SP13 that would allow Mobile mode.  Supervisor then can sign off the form in mobile mode.  Because Document Library form doesn't have Mobile client support so I decided to create this as a custom List
    form.  Now I'm finding out that when I right click on the section on the form to enable e-signature, there is no such option.   I appreciate it if someone can give me some suggestion on how to have a form that has both Mobile mode and e-signature
    support in SP13.
    I also noticed that the people picker doesn't work in Mobile mode.  Is that so or is there something-else I need to configure?
    Thank you.

    Hi,
    According to your description, my understanding is that you want to create an InfoPath form which supports Mobile mode and e-signature in SharePoint 2013.
    Per my knowledge, the browser-based forms cannot support signature in Mobile device.
    Here are some other products which are not free can achieve this goal for you to take a look:
    http://forums.qdabra.com/2013/06/signing-infopath-forms-part-1-electronic-signatures/
    http://www.formotus.com/16563/infopath-alternatives/infopath-forms-filling-weigh-the-options
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Error "The formula cannot refer to another column..." when trying to create a new subsite

    Hi All,
    I've been running into this error message when trying to create a new subsite
    Sorry, something went wrong
    The formula cannot refer to another column.  Check the formula for spelling mistakes or update the formula to reference only this column.
    Note everything was working fine before, this just started happening recently...
    At first I thought it was because of my template, but as I have tried, I can't even create subsite using the templates provided by Sharepoint...
    has anybody encountered similar problems recently?
    Any help is apprieciated!
    Fan Yang

    Hi Fan,
    If you create asubsite using the SharePoint default template, what error did you meet? Was it same with the error?
    Which site template did you use for the parent site?
    Please check whether you can create subsite at other site collection.
    In addition, please trace the exact error by using Correlation ID.
    Here are two great blogs for you to take a look at:
    http://www.habaneroconsulting.com/insights/An-Even-Better-Way-to-Get-the-Real-SharePoint-Error#.UwrFamiwrwo
    http://blog.credera.com/technology-insights/microsoft-solutions/troubleshooting-sharepoint-errors/
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • A form field (for a client fax number) on my own web site is remembering my email address used to log into the site. The usual clearing of the remembered entry works OK, but evey time I remember the login it automatically populates this one field with my

    The form where this happens contains an email field as well as a password field, so it does have both of the fields that are on the login page. It is used to modify the details of the user of our site and is accessed by the administrators, not the users themselves. To auto fill the fax field (which is named _fax) with my email address is very strange. If I log in as a different admin user then the email address I use to login appears in the field. The password field is also appears on the form and is being populated, presumably with my password. How can Firefox get it wrong and put an entry in a field with a different name, and why that field and not other empty fields on the form?
    == This happened ==
    Every time Firefox opened

    First be sure login and password are OK. Sometimes the address starts wit "http://..." and sometime starts with "ftp://...". Try both normal FTP access and Scure FTP access (SFTP). At the end, contact the site's provider.

  • Check which table has no column with specific name over number of tables

    Hello,
    Withing my schema I have 66 tables, all of them have column last_update_date. Though not all have the column program_update_date. The problem is I want to go through all the tables and know which tables does not have the program_update_date column. It is to be noted that if the table does not have the program_update_date column query 2 will be used instead of query 1.
    query1:
    select last_extract_date,
    to_char(min(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') mi,
    to_char(max(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') ma
    from table_names
    group by last_extract_date
    order by last_extract_date desc;
    query2:
    select last_extract_date,
         to_char(min(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') mi,
         to_char(max(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') ma
         from mispa_events
         group by last_extract_date
         order by last_extract_date desc ;
    Please find the PLSQL code that should be used:
    Declare
    cursor C_1 is
    select unique table_name from user_tables; table_names varchar2(240); Begin Open C_1; Loop Fetch C_1 into table_names; EXIT WHEN C_1%NOTFOUND;
    EXECUTE IMMEDIATE('select last_extract_date,
    to_char(min(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') mi,
    to_char(max(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') ma
    from ' || table_names ||'
    group by last_extract_date
    order by last_extract_date desc');
    End Loop;
    Close C_1;
    COMMIT;
    End;
    Please help.
    Thanks in advance.
    Edited by: P.Sam on Jun 14, 2010 5:00 PM

    why not use user_tab_columns
    SQL> desc user_tab_columns
    Name                                                              Null?    Type
    TABLE_NAME                                                        NOT NULL VARCHAR2(30)
    COLUMN_NAME                                                       NOT NULL VARCHAR2(30)
    DATA_TYPE                                                                  VARCHAR2(106)
    DATA_TYPE_MOD                                                              VARCHAR2(3)
    DATA_TYPE_OWNER                                                            VARCHAR2(30)
    DATA_LENGTH                                                       NOT NULL NUMBER
    DATA_PRECISION                                                             NUMBER
    DATA_SCALE                                                                 NUMBER
    NULLABLE                                                                   VARCHAR2(1)
    COLUMN_ID                                                                  NUMBER
    DEFAULT_LENGTH                                                             NUMBER
    DATA_DEFAULT                                                               LONG
    NUM_DISTINCT                                                               NUMBER
    LOW_VALUE                                                                  RAW(32)
    HIGH_VALUE                                                                 RAW(32)
    DENSITY                                                                    NUMBER
    NUM_NULLS                                                                  NUMBER
    NUM_BUCKETS                                                                NUMBER
    LAST_ANALYZED                                                              DATE
    SAMPLE_SIZE                                                                NUMBER
    CHARACTER_SET_NAME                                                         VARCHAR2(44)
    CHAR_COL_DECL_LENGTH                                                       NUMBER
    GLOBAL_STATS                                                               VARCHAR2(3)
    USER_STATS                                                                 VARCHAR2(3)
    AVG_COL_LEN                                                                NUMBER
    CHAR_LENGTH                                                                NUMBER
    CHAR_USED                                                                  VARCHAR2(1)
    V80_FMT_IMAGE                                                              VARCHAR2(3)
    DATA_UPGRADED                                                              VARCHAR2(3)
    HISTOGRAM                                                                  VARCHAR2(15)

  • How to auto populate numerous pdf files with same name and address?

    I have numerous pdf files where a company's name and address will need to be entered onto each file.  Would there be a way to enter this information once, say on an excel file or something, and then have this information auto populate all the correct fields in each and every pdf file I have to fill out.  I am a complete rookie with Adobe Acrobat.  At any one's convenience please let me know or point me in a direction where I can possibly learn this for myself.  If Adobe offers this type of service please let me know which department to contact.
    Thanks,
    John

    If you were an InDesign user, you could layout the document there, and use the Data Merge feature to bring in the names and addresses from Excel. Then create a PDF of the resulting file which could be split into individual PDFs.
    There might be a way to do it similarly with Microsoft Word and Mail Merge.

  • Topic: How to refer columns with same name in jdbc

    I have a join statement :
    Select a.col1, a.col2, b.col3, b.col2 from TABLE1 a, TABLE2 b where a.col1 = b.col1
    how do I refer with same column name suppose I want to get b.col2
    I get error when I try rs.getString("b.col2") or
    rs.getString("TABLE2.COL2")..
    note I donot want positional retrieval i.e rs.getString(x) , where x is column number.
    can you suggest how to refer the b.col2 uniquely.

    Select a.col1, a.col2, b.col3, b.col2 from TABLE1 a,
    TABLE2 b where a.col1 = b.col1You can use a column alias, like below. They "as" keyword isn't always necessary, depends on your database.
    Select
        a.col1 as a_col1,
        a.col2 as a_col2,
        b.col3 as b_col3,
        b.col2 as b_col2
    from
        TABLE1 a,
        TABLE2 b
    where
        a.col1 = b.col1

  • Custom Report: Columns with headings merged

    Hello All,
    Is there a way to get a custom layout in reports as depicted in the following image -
    http://tinypic.com/r/20sbqtx/6
    I can generate the simple layout with A, B1, B2 and B3 headings, but I'm not sure how and where to aggregate the B1, B2 and B3 into B.
    Thanks

    Create a custom report template including an extra row with column spanning in the header section of the template.

Maybe you are looking for

  • Urgent help with Index page needed

    Can anyone help? I use Dreamweaver 8 to modify and update my work's website and I've come across a very strange problem that I haven't seen before. I amended a news page, entitled 'news.html' and uploaded it as normal last week. I also put a few new

  • How do I add more stuff to a iMAC G3?

    I have a problem trying to update my iMAC G3. It runs slow, so I wanted to know how much SDRAM memory I can put into to maximize it. It has a 30gb hard disk. Can it go any higher? If so, how much, and how do I install it? My goal is to modernize this

  • Posting program

    hi,    how to Create a custom function module (posting program) which checks the credit limit for the sold to party for the outbound idoc. ganesh

  • Wants to avoid mapping for an one-to-one scenario..details in the message

    Hello Experts, Need your help on the below problem. We are in Service Pack: 08 Release: NW711_08_REL Scenario : proxy to file(tab separated) mapping: one to one structure: msgname   -recordset (0..n)       -field1 (0..1)       -field2 (0..1)       -f

  • Why does the folder structure in RH not reflect what is in Windows Explorer?

    Does anyone know why when I create a folder in the RoboHelp project e.g. "Job Aids" using Windows Explorer and store Word docs in it, that I am unable see that particular folder and its contents within RoboHelp's Project Manager? Thanks