Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Using LEFT function in SUMMARIZECOLUMNS statement

Hi,

 

I'm trying to pull the leftmost 10 characters of the Description field, below.  How would I change the below to do so?  I know this should be pretty basic but I've been working on it for some time and can't figure it out.  

 

DEFINE VAR _items = 
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
    Items[ID],
    Items[Color],
    Items[Description],
    FILTER (
        Items,
        Items[Color] = "Green"
        )
),

--Assign aliases:
"ID", Items[ID],
"Color", Items[Color],
"Description", Items[Description]
)EVALUATE _Items

  • Hi Anonymous 
    LEFT function will do

    DEFINE
        VAR _items =
            SELECTCOLUMNS (
                SUMMARIZECOLUMNS (
                    Items[ID],
                    Items[Color],
                    Items[Description],
                    FILTER ( Items, Items[Color] = "Green" )
                ),
                --Assign aliases:
                "ID", Items[ID],
                "Color", Items[Color],
                "Description", LEFT ( Items[Description], 10 )
            )
    
    EVALUATE
    _Items

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    That works.  Thanks!

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 
    LEFT function will do

    DEFINE
        VAR _items =
            SELECTCOLUMNS (
                SUMMARIZECOLUMNS (
                    Items[ID],
                    Items[Color],
                    Items[Description],
                    FILTER ( Items, Items[Color] = "Green" )
                ),
                --Assign aliases:
                "ID", Items[ID],
                "Color", Items[Color],
                "Description", LEFT ( Items[Description], 10 )
            )
    
    EVALUATE
    _Items