Showing posts with label Repeating. Show all posts
Showing posts with label Repeating. Show all posts

Monday, January 19, 2009

Automatically add new row to repeating control

Some time ago, I wrote some post how to add a new record to a repeating table, using some code.  The code was working very well, but an answer of Jimmy (Japan) brought me to another solution. 

The code behind the Add New Record button is very simply and we don't need the overhead of opening the manifest.xsf file anymore.

The code is:  (c#)

CurrentView.ExecuteAction(ActionType.XCollectionInsert, "group2_1");

Where

Group2_1 can be found in the Advanced tab of the repeating table, the property called XmlToEdit

Monday, December 8, 2008

Check if combination of values is already entered, using Repeating Controls

Several posts explains how to use drop down list boxes in repeating tables, assuring that the users can only select values which are not selected in previous rows.  This article describes how to extend this validation, to assure the combination of several fields are not entered in previous rows.

Solution:

1. Within the repeating node, add ahidden TextBox, called UniqueValue
2. Set the Default Value to Concat(field1, field2,..)    Field 1, Field 2,... are the fields that will make the row unique
3. Add the following rule to the newly created field:
       Condition: The Expression
      
Expression: ../my:UniqueValue = (../preceding-
       sibing::my:Group2 | ../following-
       sibling::my:Group2)/my:UniqueValue)

    Action:
Show Dialog box with some message that the
     combination of fields already exists


Group2: is the name of the repeating node within the data-source