Visokio website     Downloads     Video tutorials     KnowledgeBase  
Use of functions on the Content View - Visokio Forums
Use of functions on the Content View
  • jforero     jforero January 27, 2011 9:48AM
    I am using the following question in a "Content View":
    SUBSET_SINGLETON([Value],SUBSET3([Metric],[Month],[Year],"Visitors",[Month],[Year])) 
    But I am receiving this message:
    "Fields are not accessible in embedded formulas"
    Please let know us if it have any constraints to use this type of formulas on the content view?
  • 1 Comment
  •     steve January 27, 2011 12:56PM
    Javier,

    When you use formula fields in Omniscope, you are able to use "field value references". For example, take the formula "[a] + [b]". When evaluating row 1's formula result, "[a]" means "the value of field 'a' in row 1". This is a "field value reference". Formula fields are always evaluated in the context of a "current row".

    In the Content View, formulas inside text don't have the concept of a "current row". Instead, they are evaluated in the context of the view's data table.

    So you can't use e.g. "[a] + [b]". You are limited to using "field references" rather than "field value references".

    For example, the SUBSET_SUM(field, subset) function, if used without the subset argument, might read: SUBSET_SUM([a]). In this case we're providing the field reference. You would read this as "give me the sum of 'a' for all records in the view's data table".

    The same applies for SUBSET_SINGLETON(field), except this means "give me the single common value in 'a' for all records in the view's data table, or null if there is no single common value".

    However you're using the SUBSET() function to provide a subset of data. You are using SUBSET3 in the longer form SUBSET3(field1, field2, field3, value1, value2, value3).

    In this case: SUBSET3( [Metric], [Month], [Year], "Visitors", [Month], [Year])

    Here, the first 3 arguments are "field references", OK in the Content View.
    And "Visitors" is a literal value, also OK.
    But the last 2 arguments "[Month]" and "[Year]" are "field value references".

    In English, your SUBSET3 would read:
    "Give me the subset of data,
    where Metric = "Visitors",
    Month = [the value of Month for the current row],
    and Year = [the value of Year for the current row]".

    You're using field value references, which is illegal in the content view. Instead you need to specify what Month and Year match values you want using the current data table or a literal value. Otherwise the Content View can't figure out what Month and Year value to use.

    Let's say the Month and Year fields both have only a single value for all records in your view's data subset. If this is so, all you need to do is use SUBSET_SINGLETON for these, as follows:

    SUBSET_SINGLETON([Value],
    SUBSET3(
    [Metric],
    [Month],
    [Year],
    "Visitors",
    SUBSET_SINGLETON([Month]),
    SUBSET_SINGLETON([Year])
    )

    See http://www.visokio.com/kb/subset-functions for more information on the subset functions, although it doesn't go into detail of these Content View restrictions.

    If this isn't clear, please post a simple example, and we'll configure the file and discuss further.

Welcome!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership