cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Error in powerapp code when replacing th existing sharepoint list with new list having same data

I have a working powerapp code in which everything works perfectly.

When I delete the sharepoint lists from connectors and connect new list with different name but same data inside, then i face issue in code.

After uploading new list, i change the list name everyhere in code with new list name and also properties of new list matches with the old list.

I get errors in patch function, where coulmn names are changed after replacing the list.

 

ForAll(RenameColumns(Filter(Clc_Befout_list,Temp_Status="New"),"ID","ID_temp","Response","Response_temp"),
Patch(AOA_TPT_Outage_Process_Demo_Response_SK1, LookUp(AOA_TPT_Outage_Process_Demo_Response_SK1,ID=ID_temp),
{
Response:Response_temp,
Start_Time: Var_Start_Time,
End_Time:Now()
}));

 

I am getting below errors in above code:

1. The function 'Renamecolumns' has some invalid arguments.

2. The specified column 'Response' doesn not exist. (whereas I have column with this name in AOA_TPT_Outage_Process_Demo_Response_SK1list)

3. The function patch has some invalid arguments.

 

If i keep Response:Response inside patch function, then error from patch goes off, but still error in renamecoulmn exists.

And also tell that why coumn names are changing after replacing the sharpoint list.?

 

2 ACCEPTED SOLUTIONS
Syndicate_Admin
Administrator
Administrator

Hi @SUPRIYAK ,

Firstly, try this syntax

ForAll(
   Filter(
      Clc_Befout_list,
      Temp_Status="New"
   ) As aPatch,
   Patch(
      AOA_TPT_Outage_Process_Demo_Response_SK1, 
	  {ID:aPatch.ID},
      {
         Response:aPatch.Response
         Start_Time: Var_Start_Time,
         End_Time: Now()
      }
   )
)

however your issue seems to be with the Response field - is the the original name of the field? Go to your List Settings, select the field and look at the end of the URL at the top to see the actual field name.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

@SUPRIYAK ,

It separates different "commands" or code instructions.

View solution in original post

16 REPLIES 16
Syndicate_Admin
Administrator
Administrator

ok sir

Syndicate_Admin
Administrator
Administrator

Hello Sir, 

 

I have a form in gallery which is fetching data from sharepoint list. Customer wants initially 1st line item only to be enabled and others to be disabled. Whene 1st line item is filled then 2nd should get enabled & 1st should get disabled. similary when 2nd line item is filled then it should get disabled and 3rd line item should get enabled and so on...  I am attaching the screenshot of the gallery view (outage activities in below screenshot):

SUPRIYAK_0-1642159022262.png

What logic we should use in this case?

@SUPRIYAK ,

Can you please post a new thread on this as it is unrelated to the subject of this one.

Syndicate_Admin
Administrator
Administrator

Hello Sir, I really appreciate your quick reply in community @WarrenBelz.

Sir, I had a working app in which deep linking was working perfectly in powerapp version 3.21112.22. 

 

but when version of powerapp increased to 3.21113.12, deep linking of my app got disturbed, which I had raised issue earlier also. In this version, I was able to navigate to required screen through deep linking, but further navigation into app was not happening.

we were struggling to rectify it.

But today, powerapp version is updated to 3.2114.18, and now deep linking of my same app has gone more disturbed. it is behaving weired and showing wrong outputs. 

Request you to kindly help because we have to give this app to our customer, and due o this version changes, our app is getting disturbed which should not happen ideally.

 

 

Hi @SUPRIYAK ,

Deep linking will change forever with the StartScreen function. Please have a read of this document.

Syndicate_Admin
Administrator
Administrator

Sir, what is the significance of semicolon in powerapps?

@SUPRIYAK ,

It separates different "commands" or code instructions.

View solution in original post

Syndicate_Admin
Administrator
Administrator

ok .. thankyou sir 

Syndicate_Admin
Administrator
Administrator

And sir, i am facing one more issue in same code:

 

If i am running my code, it is working properly.

But if i run same code ithrough deep linking, then it is not behaving same.

I have already enabled 'navigate in onstart' in seetings.

 

Below is picture-1, which is navigating to next equipment after saving response of one equipment. this is the screen which i got from running app normally.

SUPRIYAK_0-1638944012438.png

 

 

But if i run the app through deep linking then on same page after filling response, i am not navigated to required next screen, instead it is navigated to Scrn_checklist

SUPRIYAK_1-1638944012430.png

 

 

below is my code in app.onstart:

 

Set(var_Param,Param("AOA_Link"));

Set(Var_Eqp_Selected_1, LookUp(AOA_TPT_FT_startup_SK,AOA_Name=var_Param,Equipment_Name));
Set(Var_Rot_Selected, LookUp(AOA_TPT_FT_startup_SK,AOA_Name=var_Param,ROUTE));


If(Var_Rot_Selected = "OP Proc",

Set(Var_Befout_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Before Outage"),ID,Descending)).field_3);
Set(Var_Outage_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Outage"),ID,Descending)).field_3);
Set(Var_Befser_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Before Service"),ID, Descending)).field_3);
Set(Var_Service_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Service"),ID,Descending)).field_3);

Refresh(AOA_TPT_Outage_Process_Demo_Response_SK1);

If(Value(LookUp(AOA_TPT_Outage_Process_Demo_Response_SK1,And(Equip_Name=Var_Eqp_Selected_1, Response=Blank()),ID))=0,
ClearCollect(Clc_selected_equip_1,Filter(AOA_TPT_outage_demo6_SK, field_1=Var_Eqp_Selected_1));

ForAll(Clc_selected_equip_1,
Patch(AOA_TPT_Outage_Process_Demo_Response_SK1,Defaults(AOA_TPT_Outage_Process_Demo_Response_SK1),
{Equip_Name:field_1,
Outage_Step:field_2,
S_No:field_3,
Res_Dept:field_4,
Check_Type:field_6,
Check_Para:field_5}));

);

ClearCollect(Clc_Befout_list,AddColumns(FirstN(Filter(Sort(AOA_TPT_Outage_Process_Demo_Response_SK1,ID,Descending), Equip_Name=Var_Eqp_Selected_1,Outage_Step="Before Outage"),Var_Befout_Count),"Temp_Status",
If(Response=Blank(),"Pending","Completed")));

ClearCollect(Clc_Outage_list,AddColumns(FirstN(Filter(Sort(AOA_TPT_Outage_Process_Demo_Response_SK1,ID,Descending), Equip_Name=Var_Eqp_Selected_1,Outage_Step="Outage"),Var_Outage_Count),"Temp_Status",
If(Response=Blank(),"Pending","Completed")));

ClearCollect(Clc_Befser_list,AddColumns(FirstN(Filter(Sort(AOA_TPT_Outage_Process_Demo_Response_SK1,ID,Descending), Equip_Name=Var_Eqp_Selected_1,Outage_Step="Before Service"),Var_Befser_Count),"Temp_Status",
If(Response=Blank(),"Pending","Completed")));

ClearCollect(Clc_Service_list,AddColumns(FirstN(Filter(Sort(AOA_TPT_Outage_Process_Demo_Response_SK1,ID,Descending), Equip_Name=Var_Eqp_Selected_1,Outage_Step="Service"),Var_Service_Count),"Temp_Status",
If(Response=Blank(),"Pending","Completed")));

Navigate(Scrn_Outage_List_OP_Proc,ScreenTransition.Cover),


Set(Var_Rot_Selected_Cond,Var_Rot_Selected);
Set(Var_Eqp_Selected_Cond,Var_Eqp_Selected_1);
ClearCollect(Clc_Route_A_Equip_List,Filter(AOA_TP_FP_Integrated_Checklist_SK,ROUTE="Route A"));
ClearCollect(Clc_Route_B_Equip_List,Filter(AOA_TP_FP_Integrated_Checklist_SK,ROUTE="Route B"));
ClearCollect(Clc_Route_C_Equip_List,Filter(AOA_TP_FP_Integrated_Checklist_SK,ROUTE="Route C"));
ClearCollect(Clc_LA_Equip_List,Filter(AOA_TP_FP_Integrated_Checklist_SK,ROUTE="LA Check"));

ClearCollect(Clc_Equip_List_1,Filter(AOA_TPT_FT_startup_SK,ROUTE="OP Proc"));

ClearCollect(Clc_Equip_List_1,Filter(AOA_TPT_FT_startup_SK,ROUTE=Var_Rot_Selected));

ClearCollect(Clc_Check_List_1,Filter(AOA_TP_FP_Integrated_Checklist_SK,Equipment_Name=Var_Eqp_Selected_Cond));

If(Var_Rot_Selected_Cond="LA Check",ClearCollect(Clc_Check_List_2,FirstN(Filter(Sort(AOA_FT_Response_SK,ID,Descending),Equipment_Name=Var_Eqp_Selected_Cond),6));
Set(Var_LA_Cphase_prev_count,LookUp(Clc_Check_List_2,Value(Check_Sr_N)=6,Response_Value));
Set(Var_LA_Bphase_prev_count,LookUp(Clc_Check_List_2,Value(Check_Sr_N)=4,Response_Value));
Set(Var_LA_Aphase_prev_count,LookUp(Clc_Check_List_2,Value(Check_Sr_N)=2,Response_Value));,"");

Navigate(Scrn_CheckList,ScreenTransition.Cover)

);

 

And one more query, on running the app, app is showing me 'Scrn_Checklist' screen whereas i want to see 'Scrn_route list' screen on starting an app. Can you please help me to suggest where shall i change code to get required screen on starting the app.

@SUPRIYAK ,

The issue would be the same I suspect (field name changes). I am sorry but I do not have the time to look through that amount of code especially when I do not know your data structure, model or intended outcomes.

Syndicate_Admin
Administrator
Administrator

We have huge data which can be entered in excel only, and not possible to update in sharepoint list. 

Please suggest a way by which can reduce errors on uploading data through excel only.

@SUPRIYAK ,

The Excel import field name issue is a bug - I have already posted this today, so I do not have any solution as it should not happen

Syndicate_Admin
Administrator
Administrator

Thanks a lot sir... I checked the column name in URL, it was different, and when replaced it in code, everything is working fine again.

Sir please tell why coulmn names are changed after replacing the sharepoint list with different name & same data inside.

 

Code before changing list:

If(Var_Rot_Selected = "OP Proc",

Set(Var_Befout_Count, First(Sort(Filter(AOA_TPT_outage_demo6,Equip_Name=Var_Eqp_Selected_1, Outage_Step="Before Outage"),ID,Descending)).S_No);
Set(Var_Outage_Count, First(Sort(Filter(AOA_TPT_outage_demo6,Equip_Name=Var_Eqp_Selected_1, Outage_Step="Outage"),ID,Descending)).S_No);
Set(Var_Befser_Count, First(Sort(Filter(AOA_TPT_outage_demo6,Equip_Name=Var_Eqp_Selected_1, Outage_Step="Before Service"),ID, Descending)).S_No);
Set(Var_Service_Count, First(Sort(Filter(AOA_TPT_outage_demo6,Equip_Name=Var_Eqp_Selected_1, Outage_Step="Service"),ID,Descending)).S_No);

Refresh(AOA_TPT_Outage_Process_Demo_Response);

If(Value(LookUp(AOA_TPT_Outage_Process_Demo_Response,And(Equip_Name=Var_Eqp_Selected_1, Response=Blank()),ID))=0,
ClearCollect(Clc_selected_equip_1,Filter(AOA_TPT_outage_demo6, Equip_Name=Var_Eqp_Selected_1));

ForAll(Clc_selected_equip_1,
Patch(AOA_TPT_Outage_Process_Demo_Response,Defaults(AOA_TPT_Outage_Process_Demo_Response),
{Equip_Name:field_1,
Outage_Step:field_2,
S_No:field_3,
Res_Dept:field_4,
Check_Type:field_6,
Check_Para:field_5}));

);

 

Code after changing sharepoint list:

If(Var_Rot_Selected = "OP Proc",

Set(Var_Befout_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Before Outage"),ID,Descending)).field_3);
Set(Var_Outage_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Outage"),ID,Descending)).field_3);
Set(Var_Befser_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Before Service"),ID, Descending)).field_3);
Set(Var_Service_Count, First(Sort(Filter(AOA_TPT_outage_demo6_SK,field_1=Var_Eqp_Selected_1, field_2="Service"),ID,Descending)).field_3);

Refresh(AOA_TPT_Outage_Process_Demo_Response_SK1);

If(Value(LookUp(AOA_TPT_Outage_Process_Demo_Response_SK1,And(Equip_Name=Var_Eqp_Selected_1, Response=Blank()),ID))=0,
ClearCollect(Clc_selected_equip_1,Filter(AOA_TPT_outage_demo6_SK, field_1=Var_Eqp_Selected_1));

ForAll(Clc_selected_equip_1,
Patch(AOA_TPT_Outage_Process_Demo_Response_SK1,Defaults(AOA_TPT_Outage_Process_Demo_Response_SK1),
{Equip_Name:field_1,
Outage_Step:field_2,
S_No:field_3,
Res_Dept:field_4,
Check_Type:field_6,
Check_Para:field_5}));

);

 

I have highlighted the code where column names are replaced. kindly help.

Hi @SUPRIYAK ,

Did you import this using Excel? You really need to create the list in SharePoint and then import the content if you want the same field names

Syndicate_Admin
Administrator
Administrator

Hi @SUPRIYAK ,

Firstly, try this syntax

ForAll(
   Filter(
      Clc_Befout_list,
      Temp_Status="New"
   ) As aPatch,
   Patch(
      AOA_TPT_Outage_Process_Demo_Response_SK1, 
	  {ID:aPatch.ID},
      {
         Response:aPatch.Response
         Start_Time: Var_Start_Time,
         End_Time: Now()
      }
   )
)

however your issue seems to be with the Response field - is the the original name of the field? Go to your List Settings, select the field and look at the end of the URL at the top to see the actual field name.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors