Round Trip Format Specifier in Light Switch 2012

This article describes how to use the Round-Trip "R" Format Specifier in LightSwitch Visual Studio 2012.

It guarantees
that a numeric type value that is converted into a string can be parsed back into the same numeric type value. 

  • For BigInteger when the value is formatted using such a specifier, its string representation consist of all the significant digits in the BigInteger value.
  • When a single or double value is formatted using such a specifier, first it is tested for the general format, with 7 digit precision for single, and 15 digit precision for the double. Suppose the value is parsed back successfully to the same numeric value, it is simply formatted using the general format specifier.
    Suppose the value is not parsed back successfully to the same numeric value. Then it is formatted using 9 digit precision for single and 17 digit precision for double            

Note: This format can only be supported for the Single, Double and Biginteger data types.

The following describes how to create a sample showing how to use 
the Round-Trip "R" Format Specifier on a Screen.

Step 1

Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.

Solution Explorer

Right-click on "Data Sources" and choose "Add Table".

Add Table

The table appears in the table designer window. Insert the records in the following table.

Student Table

Step 2

Now once again go to the Solution Explorer, right-click on "Screens" and choose "Add Screen".

Add Screen

The Add New Screen dialog box appears. Select "Editable Grid Screen" from the Screen Template, inside the screen information, choose "Student" under screen data and provide a name to the Screen and click the "OK" button.

Add New Screen

The Screen Designer appears as shown below.

Application Designer

Step 3

Press F5 to run the application. Provide the information. You will get the following output.


Output of Editable Grid screen

Step 4

Now stop debugging the application. From the Table designer select the "Fees" record as shown in the figure below.

Select Fees from Student

Then go to the Format Pattern of Property window in the table designer and enter "R"
in the format pattern as shown below.

R format Pattern Properties

Once again press F5 to run the application. This time we will get the following output.

Output for R format Pattern

Up Next
    Ebook Download
    View all
    Learn
    View all