cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
virakones
Responsive Resident
Responsive Resident

How to use Disambiguation operator (@) on AddColumns value

Hi,

 

I have an issue in a galleries Items property, where I need to use a disambiguation operator to reference an id that is outside of a lookup scope but within that add columns formula.

 

The formula looks something like

 

 

AddColumns(
    //Ungroup below based on unique Job ids
    Ungroup(
        //add columns to our collection called Job Id, it is a lookup to that record
        AddColumns(
            colOrder,
            "Job Id",
            Filter('Dataverse Jobs','Order No.'=varOrder).'Dataverse Job'
            ),
            "Job Id"
        ),
        "Job Type",
        //Lookup the datasource, with the recently created Job Id above, to find additional details
        LookUp('Dataverse Jobs', 'Dataverse Job' = creaa_dataversejobid).JobType
)

 

 

In the above, I have a collection that I am adding a column called Job Id filtered by some values already in the collection.

I want to use this newly created Job Id to Add an additional column to get more details. The other criteria to get the Job Id originally is not exact enough to get the right details (Job Type, in this example) for this specific record. But referencing this Job Id returns an error in the monitor "The right side of the equal needs to be a constant value".

I believe this is because the id I need to reference is within that modified collection formula, but I don't have a specific source to reference with an @ because 
if I put the above into 2 collections and use the disambiguation operator (@) to reference a named source, it works as expected.

 

 

ClearCollect(
    colWithJobId,
    AddColumns(
        colOrder,
            "Job Id",
            Filter('Dataverse Jobs','Order No.'=varOrder).'Dataverse Job'
            ),
            "Job Id"
        )
);
ClearCollect(
    colWithJobType,
    AddColumns(
        colWithJobId,
        "Job Type",
        //notice the @ disambiguation below, with the collection name
        LookUp('Dataverse Jobs', 'Dataverse Job' = colWithJobId[@creaa_dataversejobid]).JobType
)

 


I want to avoid creating excessive collections, and would like to simply display the above in the Items property of the gallery. 

How to I use a disambiguation within an AddColumns formula where the source I need to disambiguate is only generated within that AddColumns? 

1 ACCEPTED SOLUTION

Accepted Solutions
virakones
Responsive Resident
Responsive Resident

So obviously as I hit enter on the post, I resolved my issue...

 

Using the As operator to change the datasource name on the fly helped solve my disambiguation issue. The below fixed formula:

 

AddColumns(
    //Ungroup below based on unique Job ids
    Ungroup(
        //add columns to our collection called Job Id, it is a lookup to that record
        AddColumns(
            colOrder,
            "Job Id",
            Filter('Dataverse Jobs','Order No.'=varOrder).'Dataverse Job'
            ),
            "Job Id"
        //Here I am using the 'As' operator to renamed this modifed collection
        ) As UngroupedIds,
        "Job Type",
        //Now I can properly reference the right id to continue with the lookup
        LookUp('Dataverse Jobs', 'Dataverse Job' = UngroupedIds[@creaa_dataversejobid]).JobType
)

 

View solution in original post

1 REPLY 1
virakones
Responsive Resident
Responsive Resident

So obviously as I hit enter on the post, I resolved my issue...

 

Using the As operator to change the datasource name on the fly helped solve my disambiguation issue. The below fixed formula:

 

AddColumns(
    //Ungroup below based on unique Job ids
    Ungroup(
        //add columns to our collection called Job Id, it is a lookup to that record
        AddColumns(
            colOrder,
            "Job Id",
            Filter('Dataverse Jobs','Order No.'=varOrder).'Dataverse Job'
            ),
            "Job Id"
        //Here I am using the 'As' operator to renamed this modifed collection
        ) As UngroupedIds,
        "Job Type",
        //Now I can properly reference the right id to continue with the lookup
        LookUp('Dataverse Jobs', 'Dataverse Job' = UngroupedIds[@creaa_dataversejobid]).JobType
)

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (7,226)