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

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,375)