{
var AppProcess = Sys[\"WaitProcess\"](\"AXISEL\");
var ArrProps = new Array(\"Description\",\"ObjectType\");
var ArrVals = new Array(\"*Batch Name: GlaaS Post Job Submission*\",\"ListItem\");
var ListJob = AppProcess[\"FindAllChildren\"](ArrProps,ArrVals,1000);
var ArrLength1 = ListJob.length;
var ArrLength = ListJob.Count;
ListJob[ArrLength - 1].Click();
Delay(1000);
}
Hi,
For the code below, the length of Array is returned undefined, even though the Array is not empty. I have tried using both \"length\" and \"Count\" to get the length of Array but it is returning undefined for both. Please help me figure out what I am missing, I don't see anything wrong with the code.
function Test1()
{
var AppProcess = Sys[\"WaitProcess\"](\"AXISEL\");
var ArrProps = new Array(\"Description\",\"ObjectType\");
var ArrVals = new Array(\"*Batch Name: GlaaS Post Job Submission*\",\"ListItem\");
var ListJob = AppProcess[\"FindAllChildren\"](ArrProps,ArrVals,1000);
var ArrLength1 = ListJob.length;
var ArrLength = ListJob.Count;
ListJob[ArrLength - 1].Click();
Delay(1000);
}
It's hard to understand what you are doing and have no idea where to begin to help you debug. The issue you're encountering return undefined, suggests that ListJob is not an array or an object that has properties (length or Count). Instead, it seems like ListJob may be some other type of object that doesn't directly support these properties.
\nUse ChatGPT to ask your question as you posted it, it will provide you with suggestion and recommendation on how to debug this code.
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"203","kudosSumWeight":0,"repliesCount":0,"postTime":"2025-03-04T11:40:56.054-08:00","lastPublishTime":"2025-03-04T11:40:56.054-08:00","metrics":{"__typename":"MessageMetrics","views":22},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:275065/message:275066","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"readOnly":false,"editFrozen":false,"body@stringLength":"490","rawBody":"It's hard to understand what you are doing and have no idea where to begin to help you debug. The issue you're encountering return undefined, suggests that ListJob is not an array or an object that has properties (length or Count). Instead, it seems like ListJob may be some other type of object that doesn't directly support these properties.
\nUse ChatGPT to ask your question as you posted it, it will provide you with suggestion and recommendation on how to debug this code.
","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:275066_1"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}}},"AssociatedImage:{\"url\":\"https://community.smartbear.com/t5/s/nwkab66374/images/cmstMzMtV3lDSm9v\"}":{"__typename":"AssociatedImage","url":"https://community.smartbear.com/t5/s/nwkab66374/images/cmstMzMtV3lDSm9v","height":20,"width":20,"mimeType":"image/png"},"Rank:rank:33":{"__typename":"Rank","id":"rank:33","position":4,"name":"Champion Level 3","color":"FF730B","icon":{"__ref":"AssociatedImage:{\"url\":\"https://community.smartbear.com/t5/s/nwkab66374/images/cmstMzMtV3lDSm9v\"}"},"rankStyle":"OUTLINE"},"User:user:104801":{"__typename":"User","id":"user:104801","uid":104801,"login":"rraghvani","biography":null,"registrationData":{"__typename":"RegistrationData","status":null,"registrationTime":"2022-01-18T00:46:16.751-08:00"},"deleted":false,"email":"","avatar":{"__typename":"UserAvatar","url":"https://community.smartbear.com/t5/s/nwkab66374/images/dS0xMDQ4MDEtMTg1NDFpRTRGRjZBNEU5NURBMjRCOA"},"rank":{"__ref":"Rank:rank:33"},"entityType":"USER","eventPath":"community:nwkab66374/user:104801"},"ModerationData:moderation_data:275067":{"__typename":"ModerationData","id":"moderation_data:275067","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"AcceptedSolutionMessage:message:275067":{"__typename":"AcceptedSolutionMessage","uid":275067,"id":"message:275067","revisionNum":1,"author":{"__ref":"User:user:104801"},"readOnly":false,"repliesCount":2,"depth":1,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:testcomplete-questions"},"parent":{"__ref":"ForumTopicMessage:message:275065"},"conversation":{"__ref":"Conversation:conversation:275065"},"subject":"Re: Length of Array is returned as undefined","moderationData":{"__ref":"ModerationData:moderation_data:275067"},"body":"I haven't tested the code, but could you replace the code with this, to see if it logs the length of ListJob.
\nvar ListJob = AppProcess[\"FindAllChildren\"](ArrProps,ArrVals,1000);\n\n// Replace the above with this\n\nvar ListJob = AppProcess[\"FindAllChildren\"](ArrProps, ArrVals, 1000)[\"toArray\"]();\nLog[\"Message\"](\"Total number of ListJob: \" + ListJob[\"length\"]);\n
\n","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"203","kudosSumWeight":0,"postTime":"2025-03-04T12:35:41.509-08:00","lastPublishTime":"2025-03-04T12:35:41.509-08:00","solution":true,"metrics":{"__typename":"MessageMetrics","views":43},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:275065/message:275067","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuMnwyLjF8b3wzfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:275068"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"editFrozen":false,"body@stringLength":"441","rawBody":"
I haven't tested the code, but could you replace the code with this, to see if it logs the length of ListJob.
\n","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:275067_1"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}},"body@stripHtml({\"removeProcessingText\":true,\"removeSpoilerMarkup\":true,\"removeTocMarkup\":true,\"truncateLength\":200})@stringLength":"203","videos":{"__typename":"VideoConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:275068":{"__typename":"ModerationData","id":"moderation_data:275068","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":"member"},"ForumReplyMessage:message:275068":{"__typename":"ForumReplyMessage","uid":275068,"id":"message:275068","revisionNum":1,"author":{"__ref":"User:user:103711"},"readOnly":false,"repliesCount":1,"depth":2,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:testcomplete-questions"},"parent":{"__ref":"AcceptedSolutionMessage:message:275067"},"conversation":{"__ref":"Conversation:conversation:275065"},"subject":"Re: Length of Array is returned as undefined","moderationData":{"__ref":"ModerationData:moderation_data:275068"},"body":"
Hi rraghvani,
Thank you so much for your response, converting it toArray worked!!
Thanks,
Hina
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"105","kudosSumWeight":0,"postTime":"2025-03-04T13:11:35.722-08:00","lastPublishTime":"2025-03-04T13:11:35.722-08:00","metrics":{"__typename":"MessageMetrics","views":21},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:275065/message:275068","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuMnwyLjF8b3wxfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:275079"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"editFrozen":false,"body@stringLength":"125","rawBody":"Hi rraghvani,
Thank you so much for your response, converting it toArray worked!!
Thanks,
Hina
","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:275068_1"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}}},"ModerationData:moderation_data:275079":{"__typename":"ModerationData","id":"moderation_data:275079","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:275079":{"__typename":"ForumReplyMessage","author":{"__ref":"User:user:104801"},"id":"message:275079","revisionNum":2,"uid":275079,"depth":3,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:testcomplete-questions"},"parent":{"__ref":"ForumReplyMessage:message:275068"},"conversation":{"__ref":"Conversation:conversation:275065"},"subject":"Re: Length of Array is returned as undefined","moderationData":{"__ref":"ModerationData:moderation_data:275079"},"body":"I haven't touched C++ for many years, so I am a bit rusty with C++ coding!
\nWithout [\"toArray\"]() it will return a memory reference of the object. So you need [\"toArray\"]() to convert to an array of objects. You can access object properties such as length of the array via [\"length\"]
\nJavaScript is less complicated and easier to understand. C++ is very old now.
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"213","kudosSumWeight":1,"repliesCount":0,"postTime":"2025-03-05T01:14:53.799-08:00","lastPublishTime":"2025-03-05T01:16:05.802-08:00","metrics":{"__typename":"MessageMetrics","views":13},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:275065/message:275079","customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"readOnly":false,"editFrozen":false,"body@stringLength":"423","rawBody":"I haven't touched C++ for many years, so I am a bit rusty with C++ coding!
\nWithout [\"toArray\"]() it will return a memory reference of the object. So you need [\"toArray\"]() to convert to an array of objects. You can access object properties such as length of the array via [\"length\"]
\nJavaScript is less complicated and easier to understand. C++ is very old now.
","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:275079_2"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}}},"QueryVariables:MessageSolutions":{"__typename":"QueryVariables","id":"MessageSolutions","value":{"first":10,"constraints":{"topicId":{"eq":"message:275065"},"solution":{"eq":true}},"sorts":{"postTime":{"direction":"ASC"}},"useAvatar":true,"useAuthorLogin":true,"useAuthorRank":false,"useBody":true,"useKudosCount":false,"useTimeToRead":false,"useMedia":true,"useRepliesCount":false,"useSearchSnippet":false,"useAcceptedSolutionButton":true,"useSolvedBadge":false,"useAttachments":true,"useTags":false,"useUserHoverCard":false,"useNodeHoverCard":false,"usePreviewSubjectModal":false,"useMessageStatus":false}},"CachedAsset:text:en_US-components/messages/EscalatedMessageBanner-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/EscalatedMessageBanner-1741125846000","value":{"escalationMessage":"Escalated to Salesforce by {username} on {date}","viewDetails":"View Details","modalTitle":"Case Details","escalatedBy":"Escalated by: ","escalatedOn":"Escalated on: ","caseNumber":"Case Number: ","status":"Status: ","lastUpdateDate":"Last Update: ","automaticEscalation":"automatic escalation","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-components/users/UserLink-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/users/UserLink-1741125846000","value":{"authorName":"View Profile: {author}","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserRank-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserRank-1741125846000","value":{"rankName":"{rankName}","userRank":"Author rank {rankName}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageTime-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageTime-1741125846000","value":{"postTime":"Published: {time}","lastPublishTime":"Last Update: {time}","conversation.lastPostingActivityTime":"Last posting activity time: {time}","conversation.lastPostTime":"Last post time: {time}","moderationData.rejectTime":"Rejected time: {time}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolvedBadge-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolvedBadge-1741125846000","value":{"solved":"Solved"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSubject-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSubject-1741125846000","value":{"noSubject":"(no subject)"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageBody-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageBody-1741125846000","value":{"showMessageBody":"Show More","mentionsErrorTitle":"{mentionsType, select, board {Board} user {User} message {Message} other {}} No Longer Available","mentionsErrorMessage":"The {mentionsType} you are trying to view has been removed from the community.","videoProcessing":"Video is being processed. Please try again in a few minutes.","bannerTitle":"Video provider requires cookies to play the video. Accept to continue or {url} it directly on the provider's site.","buttonTitle":"Accept","urlText":"watch"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageCustomFields-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageCustomFields-1741125846000","value":{"CustomField.default.label":"Value of {name}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageReplyButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageReplyButton-1741125846000","value":{"repliesCount":"{count}","title":"Reply","title@board:BLOG@message:root":"Comment","title@board:TKB@message:root":"Comment","title@board:IDEA@message:root":"Comment","title@board:OCCASION@message:root":"Comment"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolutionList-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolutionList-1741125846000","value":{"emptyDescription":"No has been message solutions yet"},"localOverride":false},"CachedAsset:text:en_US-components/messages/AcceptedSolutionButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/AcceptedSolutionButton-1741125846000","value":{"accept":"Mark as Solution","accepted":"Marked as Solution","errorHeader":"Error!","errorAdd":"There was an error marking as solution.","errorRemove":"There was an error unmarking as solution.","solved":"Solved","topicAlreadySolvedErrorTitle":"Solution Already Exists","topicAlreadySolvedErrorDesc":"Refresh the browser to view the existing solution"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000","value":{"loadMore":"Show More"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageView/MessageViewInline-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageView/MessageViewInline-1741125846000","value":{"bylineAuthor":"{bylineAuthor}","bylineBoard":"{bylineBoard}","anonymous":"Anonymous","place":"Place {bylineBoard}","gotoParent":"Go to parent {name}"},"localOverride":false},"Revision:revision:275079_2":{"__typename":"Revision","id":"revision:275079_2","lastEditTime":"2025-03-05T01:16:05.802-08:00"},"Revision:revision:275066_1":{"__typename":"Revision","id":"revision:275066_1","lastEditTime":"2025-03-04T11:40:56.054-08:00"},"Revision:revision:275067_1":{"__typename":"Revision","id":"revision:275067_1","lastEditTime":"2025-03-04T12:35:41.509-08:00"},"Revision:revision:275068_1":{"__typename":"Revision","id":"revision:275068_1","lastEditTime":"2025-03-04T13:11:35.722-08:00"},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1741125846000","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"testcomplete-questions","messageSubject":"length-of-array-is-returned-as-undefined","messageId":"275065"},"buildId":"q_bLpq2mflH0BeZigxpj6","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","openTelemetryClientEnabled":false,"openTelemetryConfigName":"smartbear","openTelemetryServiceVersion":"25.2.0","openTelemetryUniverse":"prod","openTelemetryCollector":"http://localhost:4318","openTelemetryRouteChangeAllowedTime":"5000","apolloDevToolsEnabled":false,"inboxMuteWipFeatureEnabled":false},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["./components/seo/QAPageSchema/QAPageSchema.tsx","./components/community/Navbar/NavbarWidget.tsx","./components/community/Breadcrumb/BreadcrumbWidget.tsx","./components/messages/TopicWithThreadedReplyListWidget/TopicWithThreadedReplyListWidget.tsx","./components/messages/MessageListForNodeByRecentActivityWidget/MessageListForNodeByRecentActivityWidget.tsx","./components/messages/RelatedContentWidget/RelatedContentWidget.tsx","./components/customComponent/CustomComponent/CustomComponent.tsx","./components/messages/MessageView/MessageViewStandard/MessageViewStandard.tsx","./components/messages/ThreadedReplyList/ThreadedReplyList.tsx","../shared/client/components/common/List/UnstyledList/UnstyledList.tsx","./components/messages/MessageView/MessageView.tsx","../shared/client/components/common/Pager/PagerLoadMore/PagerLoadMore.tsx","./components/messages/MessageView/MessageViewInline/MessageViewInline.tsx","./components/customComponent/CustomComponentContent/TemplateContent.tsx"],"appGip":true,"scriptLoader":[]}