cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
andrejs91
Level: Powered On

Column already exists error

2020-02-26 08_47_28-Clipboard.png

 

Lets say I have three lists in SharePoint, DATASETS and SIGNAL_TYPES related many-to-many by means of the third table Dataset_to_SignalType where IDs of both are stored.
In my button OnSelect I have the following code, where I try to create a ds_to_st collection similar to Dataset_to_SignalType, but containing actual string names (not IDs) of Datasets and SignalTypes.

Somehow I get an error when AddColumns to a temporary collection z3: the column SignalType already exists. Although, it is clear that I just populated z3 with SignalTypeId and DatasetId. Seems like I am doing something fundamentally wrong here.

Thanks for help

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Column already exists error

Hi @andrejs91 ,

Based on the error message that you mentioned, it seems to tell that you have added the "SingnalType" column into the z3 collection.

Please check if you have initialized the z3 collection in some other place in your app. Also I found that there is something issue the formula you provided, you could not populate the AddColumns(...) result into same z1 collection initialized before.

 

As as fixed solution, please consider take a try with the following workaround:

Modify your formula as below:

ClearCollect(z1, ForAll(...));
ClearCollect(z2, ForAll(...));
ClearCollect(counter, 0);
Clear(z3);
ForAll(
       z1,
       Collect(counter, Last(counter).Value + 1);
       Collect(
               z3,
               {
                 SignalTypeId: Last(...).Value,
                 DatasetId: Last(...).Value
               }
       )
);
// Modify formula below
ClearCollect(
             ds_to_st,
             AddColumns(
                        z3,
                        "SignalType", LookUp(SIGNAL_TYPES, SignalTypeId = z3[@SignalTypeId], SignalType),
                         "DatasetName", LookUp(DATASETS, DatasetId = z3[@DatasetId], DatasetName)
             )
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Column already exists error

Hi @andrejs91 ,

Based on the error message that you mentioned, it seems to tell that you have added the "SingnalType" column into the z3 collection.

Please check if you have initialized the z3 collection in some other place in your app. Also I found that there is something issue the formula you provided, you could not populate the AddColumns(...) result into same z1 collection initialized before.

 

As as fixed solution, please consider take a try with the following workaround:

Modify your formula as below:

ClearCollect(z1, ForAll(...));
ClearCollect(z2, ForAll(...));
ClearCollect(counter, 0);
Clear(z3);
ForAll(
       z1,
       Collect(counter, Last(counter).Value + 1);
       Collect(
               z3,
               {
                 SignalTypeId: Last(...).Value,
                 DatasetId: Last(...).Value
               }
       )
);
// Modify formula below
ClearCollect(
             ds_to_st,
             AddColumns(
                        z3,
                        "SignalType", LookUp(SIGNAL_TYPES, SignalTypeId = z3[@SignalTypeId], SignalType),
                         "DatasetName", LookUp(DATASETS, DatasetId = z3[@DatasetId], DatasetName)
             )
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

andrejs91
Level: Powered On

Re: Column already exists error

thanks for help, it wasn't exactly the solution, but it motivated my to look for it again.  And it is also good to know how to optimize the code.

Now it seems to work, but there is something I surely don't get in how MS Access-Sharepoint-PowerApps binding works. I published my sql DB to SP and then connected it to PA, but SP has modified index columns of some tables, created new column "ID" instead of DatasetId, etc. 

P.S. In the code chunk you provided is ";" missing in the very end. I was lucky to notice it in only ten minutes, because the error resulting is nothing simple like "hey, friend, I miss end of statement here", but something completely unhelpful.

 

 

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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