Wednesday, February 13, 2013

Declare Calculated type field in content type

I had a requirement to create a calculated field in the content type to combine document id and generation id into full document id. The twist was to format the ID and Generation into the form 00000-00 (i.e. padding additional 0's)


<Field ID="{979A0DF9-4FD2-4A15-A459-19B351479067}" Name="FullDocumentID" DisplayName="Full DocumentID" Type="Calculated" ResultType="Text" Required="FALSE" AllowDeletion="FALSE" ShowInDisplayForm="TRUE" ShowInEditForm="FALSE" ShowInNewForm="FALSE">
     <Formula>=CONCATENATE(TEXT([DocumentID],"00000"),"-",TEXT( [Generation],"00"))</Formula>
    <FieldRefs>
      <FieldRef ID="{5EF364B0-908D-44E8-BFBC-E392539B68D2}" Name="DocumentID"/>
      <FieldRef ID="{E4464EBA-6959-4FB4-B7AB-F722B8290C82}" Name="Generation"/>
    </FieldRefs>
  </Field>

populate logged in user in user type field

My content type had a field of type user
<Field ID="{7F6FA252-755B-4062-97E6-01618181968A}" Name="DocumentAuthor" DisplayName="Author" Type="User" List="UserInfo" Required="FALSE" EnforceUniqueValues="FALSE" UserSelectionMode="PeopleOnly" UserSelectionScope="0" />

customer wanted to populate the current user by default. I made use of list event receiver as below

public override void ItemAdding(SPItemEventProperties properties)
{
 //set author field to current user by default
SPWeb web = properties.Web;
SPListItem curDocument = properties.ListItem;
SPUser usr = web.CurrentUser;
SPFieldUserValue defValue = new SPFieldUserValue();
defValue.LookupId = usr.ID;
properties.AfterProperties["DocumentAuthor"] = defValue.ToString();
base.ItemAdding(properties);
}

Friday, April 22, 2005

Today was trying to hide a windows form from another form, but was not successfull, found this wokring article at http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21185658.html
was quite helpful.

Tuesday, February 08, 2005

Today I had a requirement of removing the underline in a anchor tag, figured out setting up text:decoration property to none will remove underline from gettting displayed in anchor tag.

style="text-decoration: none";

Monday, February 07, 2005

Got an error while trying to populate a datareader by executing a stored procedure using command object, The error said "General Network Error, Check your network Documentation".

Find the solution at the below link, http://weblogs.asp.net/pleloup/archive/2003/07/23/10451.aspx

just set the command.commandTimeout = 0, error stopped popping up, not sure how it fixed the error, but it is working fine :)

Tuesday, January 18, 2005

Today when I tried to add a project from sourcesafe into a solution I got an strange error message " The project you are trying to open is a Web Project. You need to open it by specifying its URL path ".

After searching net for while I got the solution at the below URL, http://www.aspnetresources.com/blog/sourcesafe_aggravation.aspx ,

well the solution was I added project.vbproj.webinfo file into the solution folder and it got loaded.
Actually this file, has the URL path for the project, that might be the reason why project was successfully added into the solution.



Wednesday, January 12, 2005

Finally able to blog today after a long break, well past seven weeks was too much to handle at the client's place in UK, well all went well and we are back at our office in Banglore.

Today, when I tried to create a query in sql 2000, got an error
"Cannot resolve collation conflict for equal to operation",

after searching net as usual came across this site which helped me in resolving the issue
http://www.ssw.com.au/SSW/KB/KB.aspx?KBID=Q211874,
thankyou David for the simple answer.

my query that gave problem was

create view SMD_EverestID ASSELECT SD.[Service Name], SD.[Module Name], SD.[Baseline or Optional], Service.ID AS ServiceID, Service_1.ID AS ModuleIDFROM ServiceModuleDependencies SD INNER JOIN Service ON SD.[Service Name] = Service.Name INNER JOIN Service Service_1 ON SD.[Module Name] = Service_1.Name

modfiied query is below:
create view SMD_EverestID ASSELECT SD.[Service Name], SD.[Module Name], SD.[Baseline or Optional], Service.ID AS ServiceID, Service_1.ID AS ModuleIDFROM ServiceModuleDependencies SD INNER JOIN Service ON SD.[Service Name] = Service.Name collate database_default INNER JOIN Service Service_1 ON SD.[Module Name] = Service_1.Name collate database_default





Tuesday, October 26, 2004

Back to office after one week of training in UML.
First problem of the day, unable to send mails thru the application, error message was "Unable to access System.CDO.Message", as usual googled it and came across this website which has loads of info on using System.web.Mail namespace. Here is the URL of the website
http://www.systemwebmail.com/faq/4.2.3.aspx



This page is powered by Blogger. Isn't yours?