Showing results for 
Search instead for 
Did you mean: 

Add a let function to introduce local scope

Consider the case where you need to set some non-behaviour property as follows:

    Foo: Lookup(ListA, title=Dropdown.Selected.Value).fooColumn,
    Bar: Lookup(ListA, title=Dropdown.Selected.Value).barColumn,
    Baz: Lookup(ListA, title=Dropdown.Selected.Value).bazColumn

In that example, we had to perform 3 lookups to the same item, because we have no way of storing data in properties. We cant use Set() in non-behaviour properties.



To improve this situation, why not introduce a let style operator, similar to clojure's (let) function, that lets us temporarily store values. 


With let, we could re-write the above as follows:

{LookupItem: Lookup(ListA, title=Dropdown.Selected.Value)}, { Foo: LookupItem.fooColumn, Bar: LookupItem.barColumn, Baz: LookupItem.bazColumn } )

This would save two network calls!


Status: New
Super User

I feel that rather than create a new function this suggestion could be used to improve upon the existing WITH function.

Regular Visitor

Huh. Turns out I've pretty much described with... Maybe update the Set and UpdateContext functions to indicate that while they can't be used in non-behaviour properties, With can. 

Advocate II



Maybe I'm not understanding the issue, but it seems that a Switch statement would work here. Use Set() or UpdateContext({}) to determine which case to follow, then execute a single lookup rather than all three.