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

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

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

Regular Visitor

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,293)