Table of Contents
[](xref:Abyss.Parts.LookUp.Index)

LookUp Sources

you are here (click to zoom) - discover the stack

The LookUp System will use the LookUp Engine to retrieve values for Queries and more.

The LookUp engine will parse tokens like [Module:ModuleId] and then look for a LookUp Source with the matching name, in this case Module.

For this to be possible, the Engine has a list of named sources like

  • Module
  • QueryString
  • Params
  • etc.

On this page we'll explain how these work, and what special sources exist.

LookUp Sources

These are the sources which are automatically included in 2sxc

  • App Sources
    1. App - the current App, which can give you folders (to link JS files) ☢️🩸
    2. App:Settings - app settings ☢️🩸
    3. App:Resources - app resources, translated labels etc. ☢️🩸
  • Web Server and System Sources Hybrid
    These work both on Dnn and Oqtane (2sxc 12+)
    1. [Query] ☢️🩸
  • Web Server and System Sources
    1. QueryString - url parameters ☢️
    2. Form - form post parameters ☢️
    3. DateTime - current date/time information ☢️🩸
  • CMS / Dnn Sources
    1. [Site]
    2. [Page]
    3. [Module]
    4. Portal - the current Dnn portal
    5. Tab - the current Dnn page
    6. Module - the current Dnn module
  • User Information Sources
    1. User
    2. Membership
    3. User Profile

Token Template Sources

In Token Templates we also have 3 special lookups

  1. Content - the current content
  2. Content:Presentation - presentation settings of the current content, if configured
  3. ListContent ?
  4. ListContent:Presentation
  5. AnyNameYouWant specified in a <repeat> tag

Query Sources

In Queries we also have the following sources

  1. In
  2. Params

DataSource Settings Source

In DataSources code you will usually only work with Settings which contain all the settings that specific DataSource should work with. The Settings source only exists in your C# code, not in the VisualQuery.

  1. Settings

What is a LookUp Source (technical ⚠)

LookUp Sources are ILookUp objects and have a Name like like QueryString, Module, Portal etc.

Each one is capable of retrieving values like Id or DefaultPage.

So the Engine will ask the specific source for the expected value and the source will try to find it. If it has an answer, it will return that. If it doesn't find anything it will return null and let the Engine take care of fallback options.

Tip

Everything is lazy, so these objects are only accessed and populated if the parameter is actually needed. This results in great performance.

All LookUp objects implement the ILookUp interface and inherit the LookUpBase object.

Internal LookUp Objects (technical ⚠)

Just to give you an idea of the power of LookUp objects, here are some in use:

  1. LookUpInEntity - this resolves entity values.
  2. LookUpInNameValueCollection - this resolves from name/value lists like Dictionary or Request.QueryString objects
  1. LookUpInLookUps - will look up values in various attached LookUp objects
  2. - will look up a value from an In stream of a DataSource
  3. ToSic.Sxc.Dnn.LookUp.LookUpInDnnPropertyAccess - will look up stuff in Dnn specific PropertyAccess objects, which are similar to LookUp objects
  4. LookUpInEntity - will look up things in an IEntity and also provide more information like Count, IsFirst, etc. for the Token Engine

Also Read

History

  1. General Tokens introduced in 2sxc 1.0
  2. Most enhancements were in 2sxc 07.00