Setting Up Pseudo Columns with LightSwitch.

There are a number of ways that you might want to refine your query results that are difficult to do with current table columns; pseudo columns can greatly simplify this. This example shows how to use pseudo columns from a LightSwitch application.

You can follow the steps below to expose the pseudo columns for any CData Data PRovider. This article uses Salesforce as an example.

What are Pseudo Columns?

Pseudo columns are used in WHERE clauses just like regular columns but are not present in any table. As an example you could create a SELECT statement with a pseudo column like this:

SELECT * FROM Accounts WHERE maxresults='10'

Passing the pseudo columns to the data provider allows for more granular control over the rows that get returned. Since they are special entities for Tables and Views they do not exist in the data table returned and cannot be read. For a list of the pseudo columns available with a particular Table or View confer with the help file supplied with the CData Data Provider. The pseudo columns are not available by default however so the rest of this tutorial will show you how to add them into your project.

Setting Up a LightSwitch Project

Follow the steps below to enable pseudo columns for a Salesforce connection.

  1. Create a new LightSwitch application: Click File -> New -> Project (or Ctrl+Shft+N). Creating New LightSwitch Application
  2. Right-click on the "Data Source" folder of the project and select to add a new source Adding New Data Source Select a Database application:

    Choosing Data Source Type
  3. In the Connection Properties Wizard enter your credentials. To connect to Salesforce you will need to put in your user name, password, and access token. To expose the pseudo columns all you need to do after this is enter *=* in the Pseudo Columns box in the Misc section. Filling Connection Properties
  4. Select the Tables and Views you wish to expose. For example, Accounts. Exposing Tables and Views

For a guide to creating a LightSwitch screen, see Connect to QuickBooks From LightSwitch Applications. Once you have created a Screen you can now query from the available columns and pseudo columns.

Using Pseudo Columns

Follow the steps below to use a pseudo column as a filter:

  1. Once you have created the screen, click Edit Query on the designer page. Clicking Edit Query
  2. Click Add Filter in the Filter section and select from the available column and pseudo columns. Adding Filters in Query