PowerDocu icon indicating copy to clipboard operation
PowerDocu copied to clipboard

Error - Length cannot be less than zero

Open NeelBI opened this issue 3 years ago • 2 comments

Hey Modery,

Thank you for the amazing documentation tool. I am running into the issue as seen in the screenshot while trying to document my app. Would you please be able to guide what the issue could be?

Please let me know if you need further inputs.

image

NeelBI avatar Nov 07 '22 15:11 NeelBI

Hi @NeelBI , pretty sure that this is caused by a "Navigate" function call in your app. PowerDocu is not able to parse it properly somehow, and thus crashes. Is it possible for you to share all code instances where you use the Navigate function?

modery avatar Nov 07 '22 16:11 modery

Hi Modery, there are quite a few places where Navigate is being called. In some buttons, it is just the navigate that is being called, in other places, the button performs several actions, like initializing a collection and then navigating etc. Below is a code snippet from three places. I can post all the other ones as well if you will need. Please let me know.

  1. Navigate(AssignUsersRoles)

  2. //Navigate(ViewExistingForecast_Final) ClearCollect(colExistingForecstMaster,CollectForecasts); ClearCollect( colExistingForecast, Filter( colExistingForecstMaster, Enabled="1"

    ) ); Navigate(ViewExistingForecast_Working)

ClearCollect( colCollectForecasts_EFAP, ShowColumns(CollectForecasts, "kfa_country", "kfa_productgroup", "kfa_startmonth", "kfa_endmonth", "kfa_nationalsubnational", "kfa_subnationallevel", "kfa_forecastingtype", "kfa_salesmetric", "kfa_salesmetric2", "kfa_approver1", "kfa_approver1_email", "kfa_approver1_smileid", "kfa_approver2", "kfa_approver2_email", "kfa_approver2_smileid", "kfa_user", "kfa_user_email", "kfa_user_smileid", "kfa_forecaststatus", "kfa_territory", "kfa_name", "kfa_enabled" ) );

ClearCollect( colCollectTerritoryUser_EFAP, ShowColumns(CollectTerritoryUsers, "kfa_fk_idd", "kfa_territory", "kfa_user_smileid", "kfa_forecaststatus" ) );

/* ClearCollect(colForecastTerritoryUser_EFAP, AddColumns(colCollectTerritoryUser_EFAP, "Country",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_country))); */

ClearCollect(colForecastTerritoryUser_EFAP_Temp, AddColumns(colCollectTerritoryUser_EFAP, "PKID",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_name), "kfa_country",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_country), "kfa_productgroup",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_productgroup), "kfa_startmonth",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_startmonth), "kfa_endmonth",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_endmonth), "kfa_nationalsubnational",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_nationalsubnational), "kfa_subnationallevel",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_subnationallevel), "kfa_forecastingtype",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_forecastingtype), "kfa_salesmetric",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_salesmetric), "kfa_salesmetric2",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_salesmetric2), "kfa_approver1_smileid",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_approver1_smileid), "kfa_approver2_smileid",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_approver2_smileid), "UserSMILEID_Nat",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_user_smileid), "Territory_Nat",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_territory), "kfa_forecastatus_parent",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_forecaststatus), "kfa_enabled",LookUp(colCollectForecasts_EFAP,kfa_name=colCollectTerritoryUser_EFAP[@kfa_fk_idd],kfa_enabled))); //"kfa_smileterritorymerged", LookUp(DimTerritories, SmileTerritory = colCollectTerritoryUser_EFAP[@kfa_territory],SmileTerritoryMerged)));

ClearCollect(colForecastTerritoryUser_EFAP,colCollectForecasts_EFAP,colForecastTerritoryUser_EFAP_Temp); Sort(Sort(colForecastTerritoryUser_EFAP,kfa_name),kfa_fk_idd);

//Clear(colForecastTerritoryUser_EFAP_Temp); //SortByColumns(colForecastTerritoryUser_EFAP,"kfa_name","kfa_fk_idd");

/* ClearCollect(colForecastTerritoryUser_EFAP, AddColumns(colCollectForecasts_EFAP,"FKID",LookUp(colCollectTerritoryUser_EFAP, kfa_fk_idd=colCollectForecasts_EFAP[@kfa_name],kfa_fk_idd),"Territory",LookUp(colCollectTerritoryUser_EFAP, kfa_fk_idd=colCollectForecasts_EFAP[@kfa_name],kfa_territory),"UserSMILEID",LookUp(colCollectTerritoryUser_EFAP, kfa_fk_idd=colCollectForecasts_EFAP[@kfa_name],kfa_user_smileid))); */

ClearCollect(colNatUser,RenameColumns(ShowColumns(Filter(colCollectForecasts_EFAP,!IsBlank(kfa_user_smileid)&& (kfa_forecaststatus<>"In setup"||kfa_forecaststatus<>"Sent to EDB" ||kfa_forecaststatus<>"Soft-Delete"||kfa_forecaststatus<>"Soft-delete")), "kfa_user_smileid"),"kfa_user_smileid","User"));

ClearCollect(colApprover1User,RenameColumns(ShowColumns(Filter(colCollectForecasts_EFAP,!IsBlank(kfa_approver1_smileid)&& (kfa_forecaststatus<>"In setup"||kfa_forecaststatus<>"Sent to EDB" ||kfa_forecaststatus<>"Soft-Delete"||kfa_forecaststatus<>"Soft-delete")),"kfa_approver1_smileid"),"kfa_approver1_smileid","User"));

ClearCollect(colApprover2User,RenameColumns(ShowColumns(Filter(colCollectForecasts_EFAP,!IsBlank(kfa_approver2_smileid) && (kfa_forecaststatus<>"In setup"||kfa_forecaststatus<>"Sent to EDB" ||kfa_forecaststatus<>"Soft-Delete"||kfa_forecaststatus<>"Soft-delete")),"kfa_approver2_smileid"),"kfa_approver2_smileid","User"));

ClearCollect(colSubnationalUsers,RenameColumns(ShowColumns(Filter(colCollectTerritoryUser_EFAP,!IsBlank(kfa_user_smileid)),"kfa_user_smileid"),"kfa_user_smileid","User"));

ClearCollect(colAvailableUsers,colNatUser,colApprover1User,colApprover2User,colSubnationalUsers);

Navigate(EnterApproveForecasts_Admin_Redesign);

NeelBI avatar Nov 08 '22 06:11 NeelBI