.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Assign value of a current field to the value of a previous field

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :

I am trying to assign a value to a row based on the value of a field in the previous row. In this case, I am able to identify where first left character of the item number of the previous row is 5. When this is true I need to display the value of the meal_typ field in each succsessive row until the condition is met again. So far the only thing that I have managed to do is pass the value to the first line.

I'm just not sure how to approach this issue. Perhaps there is a way to set a field in the main query equal to the result of the case in the subquery? Or perhaps there is a way to assign a variable to the subquery and set another variable equal to it in the main query? I haven't been able to make it work yet but I believe that there must be a way.

I am not able to use a stored procedure for this because I need to post this in our ERP systems "sql query requester" which does not recognize references to a stored procedure.

Here is the query i am using now and a sample of the current result set:

select cur.line_nbr, cur.item_nbr, cur.meal_typ, 

(select case when left<

View Complete Post

More Related Resource Links

Set Field in Current Item to a previous version's field value

When using SPD, can you make a WF condition to set a field's value to it's previous version's value? Versioning is turned on for this doc library, but checkin/checkout is not on. These WF's run only after creation and editing, so I need to set a value back if a user doesn't have permission to set a choice column field to specific values. Thanks in advance, Chris

Set up a validator that compare the value of the current field with an other (using Dynamic Data)

Hi! Most of it is in the title : I'd like have a validator on the DateTime_Edit template for example that allows to compare this field with an other DateTime field. My problem is when I am in the DateTime_Edit template of my "master field" (the one I want to check), how can I access to the other field given the architecture of Dynamic Data FieldTemplates? But perhaps I'm not thinking in a good way on this control. Any advice will be welcome. Thanks Raphaelp

How do I keep the previous GridView field value and then concatenate new ones?

Hello all, I have a Timer and a GridView who pulls info from the database every X seconds.Every time I query the database the field 'Comments' is replaced with whatever is on the database  (since it's bound to it).I'd like to keep my previous value and keep adding into my Label the subsequent values queried from the database. For instance, first time I query I get a value of "1" in the Gridview. Now someone changes the database row and next time I queryit I have a value of "2". Well, I would like to concatenate the last value queried with the previous one and so on. So at this point the GridView should show "1" and "2". Here is the piece of code I am talking about: <asp:TemplateField HeaderText="Comments" SortExpression="Comments"> <ItemTemplate>  <asp:Label ID="lblComments" runat="server" Text='<%# Bind("Comments") %>' /> </ItemTemplate></asp:TemplateField> How do I achieve this goal? Thank you!

Excecution of wait for field change in current item action

Hi everybody, I've an SharePoint designer WorkFlow with two simple actions: wait for field change in current item (wait for the aproval status was approved) update item list(set a value to a field in the current item) how immediate is the execution of an workflow like this by the WF Runtime engine?, how it works? would be possible that WF runtime engine take time to execute this tasks, how much is waranteed acording the WF architecture? The Previous question becouse this solution is composed by an smart document and a workflow: -A workflow that have to copy the aproval status  to a field when this was aproved. -The document have to detect the change on the field value(seted by the workflow) when the document is closed by the user(this action could be executed just after the user approve). In conclusion the document depends from the workflow execution to detect the change, if the workflow were not executed "immediately" document actions would not be executed when the document were closed. by the above I need to know how reliable is this workaround and make a choice, this workaround or an event handler controling the itemupdating event(synchronous event) to do the tasks made by the workflow. Suggestions are welcome! PD and Background: The smart document(with managed code) is the template associated to the content type in a document library. The Current

Problems with "Set Field in Current Item" in SP 2007 Workflow

I have created a workflow in spd 2007 that begins by comparing two lists and if the “VendorName” is the same on both lists, I then auto-populating four fields by grabbing the values from another list within same site collection by using the “Set Field in Current Item” action. I have recently discovered that I cannot set additional fields beyond these four fields. I have tried this on two different sites using the same action (i.e. set field in current item) and the result is the same – I cannot add additional actions of this type? To remedy this, I removed duplicate instances of the workflow via List Settings > Workflow Settings > remove dups, but no luck. Problems still persists.   What would be causing this? Has anyone run across this issue? Help!   Thank you in advance.

Set Field in current item

Hi i have created a workflow where the first step is to use the Action Set field in current item. The item is a field called time of status the workflow changes this status from blank to open when a new item is added, the workflow seems to run but just sits in a IN Progress state and does not complete. Does anyone one know of a reason why this would be. Thanks John

filling current user name in people picker field when loading form using javascript


Hello guys,

I am looking is there any way to fill the current user's name in people picker field in newform.aspx using javascript?

If you anything, please let me know 


How to assign value to managed metadata field from client object model?


I am working on the project that is based on Client Object Model which should be able to create/update document sets form client side with possibility to fully manage column values. I've managed so far to manipulate from client most of field values but i'm still struggling with managed metadata fields. I know that there isn't any support for this type of field in CSOM so I used TaxonomyClientService which is available from server side and managed to retrieve data necessary for displaying field info. I also discovered that value for this field should be assigned in string form like [WssId]#[TermName]|[TermGUID] to be valid. My problem is how to retrieve WssId. I know it can be found in TaxonomyHiddenList of site collection but since it contains only values that were used in site collection so far it doesn't represent full solution for my problem. Any help would be appreciated.

Thanks in advance..

Updating Person/Group Field when Current User Clicks Button


Hi all,

Im trying to either add the current user to a multi person/group field or remove them if they are already in the field when they click a button. My code works to decide which button to render on the page - it will show "Add" if the current user is not in the multi person/group field (titled Members) or it will display "Remove" if the current user already exists in the multi person/group field.

My problem is that when the user clicks the button, i want to take the value in the multi person/group field and use XSL string functions to either add/remove the current user to/from the string and push the updated string back into the multi person/group field - This is not working for me. I can reference the correct column with javascript, but it seems the value i get from the person/group column is not just a simple string, its got all sorts of HTML in there. I was hoping just to get a string like, "member1;member2;...). Ive tried changing the field to just display the account (rather than the name with presence), but it still pulls back a huge chunk of code that i cant work with.

Below is my code so far, just to give you an idea - anyone know what im doing wrong?


difference between Set Field in Current Item versus Update List Item?

Is there a technical different between Set Field in Current Item and  Update List Item if the field in the item being updated with in the same list the workflow is attached to?  It seems like there wouldn't be any difference - that you could use one or the other.  But I'm having trouble with my workflow.  It completes without error, but the field in my current list item isn't being updated (getting the value from another list in same site).
There are no mistakes; every result tells you something of value about what your are trying to accomplish.

How to assign values to workflow task person or group custom field?

Using visual studio 2008, in createTask_MethodInvoking, I have the following code. RequestFields has the values from the InfoPath form. ApprovingPersons is a person or group field, added to the task list by my custom task content type. I checked the task list associated with the workflow and I see the custom field.

SPUser user;
SPFieldUserValueCollection fuvc = new SPFieldUserValueCollection();
foreach (Contact person in RequestFields.Persons)
      user = workflowProperties.Web.EnsureUser(person.LoginName);
      fuvc.Add(new SPFieldUserValue(workflowProperties.Web, user.ID, user.Name));

// this is the line causing problem, I believe
PreApprovalTask_TaskProperties.ExtendedProperties["ApprovingPersons"] = fuvc;

I got the following error message:

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] argument



assign default value to dynamic data field



I have the script below and I want to apply a default value to the DynamicField StudentId (please see line in bold) below. Can anyone tell me how to do so?




        <asp:GridView ID="GridViewGuardians"  runat="server" SelectedIndex="1"
            AutoGenerateColumns="false" DataKeyNames="StudentGuardianId" DataSourceID="LinqDataSourceGuardians" ShowHeader="true" ShowFooter="True">
                   <asp:LinkButton  ID="lbInsertGuardianG" runat="server" CommandName="Insert" ValidateionGroup="addValidationGuardian" OnClick="lbInsertGuardianG_Click" >Insert</asp:LinkButton>

How to access the data item(current row) in the field template control?



     How to access the data item(current row) in the field template control? 

when I select to 'set field in current item', the only option available is name


Hi Clayton,

I have published my form and promoted the fields and ticked the appropriate box when publishing, but when I select to 'set field in current item', the only option available is name (For Use In Forms). I would like to be able to set the value of an infopath field from within the SPD workflow workflow. So for instance, when the form is approved, a field is set to approved on the form and a button becomes available.


Thanks in advance

calculation, field and map traverse adjustment, and coordinate transformation

Free Pocket PC land surveying software -- COGO calculation, field and map traverse adjustment, and coordinate transformation -- for students and professionals.

Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend