cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SUPRIYAK
Helper III
Helper III

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

Accepted Solutions
WarrenBelz
Super User
Super User

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
WarrenBelz
Super User
Super User

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

SUPRIYAK
Helper III
Helper III

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

SUPRIYAK
Helper III
Helper III

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
Helper III
Helper III

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

@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.

SUPRIYAK
Helper III
Helper III

ok .. thankyou sir 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,174)