cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Add Column to Collection

In my app I'm using a button to create "colTempLostTime" based on a dropdown selections.  I then take "colTempLostTime", add a column called "Description" and call it "colFilteredLostTime".  When I create "colFilteredLostTime" it added the column as expected.  The added column should return the description from "colLostTimeCode" based on the LostTimeCodeID.  The issue is that every row returns the result from the description of "colLostTimeCode".  Any thoughts on what I can do to return the correct result based on the LostTimeCodeID.  

ClearCollect(
colTempLostTime,
Filter(
'[dbo].[_LostTimeData]',
Department = Dropdown_Department.Selected.Result
)
);
ClearCollect(
colFilteredLostTime,
AddColumns(
colTempLostTime,
"Description",
LookUp(
colLostTimeCodes,
ThisRecord.LostTimeCodeID = LostTimeCodeID,
LostTimeCodeDescription
)
)
)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Add Column to Collection

You can use the As operator to alias the colTempLostTime to a different name and prevent the conflict of the two 'LostTimeCodeID' columns:

 

ClearCollect(
  colTempLostTime,
  Filter(
    '[dbo].[_LostTimeData]',
    Department = Dropdown_Department.Selected.Result));
ClearCollect(
  colFilteredLostTime,
  AddColumns(
    colTempLostTime As temp,
    "Description",
    LookUp(
      colLostTimeCodes,
      ThisRecord.LostTimeCodeID = temp.LostTimeCodeID,
      LostTimeCodeDescription)))

 

Hope this helps!

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Add Column to Collection

@Shippen70 

Consider changing your formula to the following:

ClearCollect(
    colTempLostTime,
    Filter('[dbo].[_LostTimeData]',
        Department = Dropdown_Department.Selected.Result
    )
);

ClearCollect(colFilteredLostTime,
    AddColumns(
        AddColumns(colTempLostTime,"LTCid", LostTimeCodeID),
        "Description",
            LookUp(colLostTimeCodes,
                LostTimeCodeID = LTCid,
                LostTimeCodeDescription
            )
        )
     )
)

ThisRecord has some strange results in context of other formulas.  I believe there are still some issues to work out on that new function.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Super User III
Super User III

Re: Add Column to Collection

@Shippen70 

Any chance you could supply some sample data: one table showing the data from colTempLostTime and the other showing what the solution should look like.  I am quite adapt at collections but it always helps to be able to visualize these things 🙂

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Power Apps
Power Apps

Re: Add Column to Collection

You can use the As operator to alias the colTempLostTime to a different name and prevent the conflict of the two 'LostTimeCodeID' columns:

 

ClearCollect(
  colTempLostTime,
  Filter(
    '[dbo].[_LostTimeData]',
    Department = Dropdown_Department.Selected.Result));
ClearCollect(
  colFilteredLostTime,
  AddColumns(
    colTempLostTime As temp,
    "Description",
    LookUp(
      colLostTimeCodes,
      ThisRecord.LostTimeCodeID = temp.LostTimeCodeID,
      LostTimeCodeDescription)))

 

Hope this helps!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,745)