Hello,
I need to store key value pairs in a macro, namely an error code with a description.
How can I retrieve the description when knowing the error code in Basic?
I have all the data in this format:
ERRORS = [
(“1003”, “Statement is not available.”),
(“1004”, “Statement is incomplete at this time. Please try again shortly.”),
(“1005”, “Settlement data is not ready at this time. Please try again shortly.”),
(“1006”, “FIFO P/L data is not ready at this time. Please try again shortly.”),
(“1007”, “MTM P/L data is not ready at this time. Please try again shortly.”),
(“1008”, “MTM and FIFO P/L data is not ready at this time. Please try again shortly.”),
(“1009”, “The server is under heavy load. Statement could not be generated at this time. Please try again shortly.”),
(“1010”, “Legacy Flex Queries are no longer supported. Please convert over to Activity Flex.”),
(“1011”, “Service account is inactive.”),
(“1012”, “Token has expired.”),
(“1013”, “IP restriction.”),
(“1014”, “Query is invalid.”),
(“1015”, “Token is invalid.”),
(“1016”, “Account in invalid.”),
(“1017”, “Reference code is invalid.”),
(“1018”, “Too many requests have been made from this token. Please try again shortly.”),
(“1019”, “Statement generation in progress. Please try again shortly.”),
(“1020”, “Invalid request or unable to validate request.”),
(“1021”, “Statement could not be retrieved at this time. Please try again shortly.”),
]
Now I want to access the string “statment is not available” when I only know the error code. e.g.1003 in this case.
Up to now my best guess would be to create an array like:
Dim ERRORS()
ERRORS = Array(Array(“1003”, “Statement is not available.”), +_
Array(“1004”, “Statement is incomplete at this time. Please try again shortly.”),+_
Array(“1005”, “Settlement data is not ready at this time. Please try again shortly.”),+_
Array(“1006”, “FIFO P/L data is not ready at this time. Please try again shortly.”),+_
Array(“1007”, “MTM P/L data is not ready at this time. Please try again shortly.”),+_
Array(“1008”, “MTM and FIFO P/L data is not ready at this time. Please try again shortly.”),+_
Array(“1009”, “The server is under heavy load. Statement could not be generated at this time. Please try again shortly.”),+_
Array(“1010”, “Legacy Flex Queries are no longer supported. Please convert over to Activity Flex.”),+_
Array(“1011”, “Service account is inactive.”),+_
Array(“1012”, “Token has expired.”),+_
Array(“1013”, “IP restriction.”),+_
Array(“1014”, “Query is invalid.”),+_
Array(“1015”, “Token is invalid.”),+_
Array(“1016”, “Account in invalid.”),+_
Array(“1017”, “Reference code is invalid.”),+_
Array(“1018”, “Too many requests have been made from this token. Please try again shortly.”),+_
Array(“1019”, “Statement generation in progress. Please try again shortly.”),+_
Array(“1020”, “Invalid request or unable to validate request.”),+_
Array(“1021”, “Statement could not be retrieved at this time. Please try again shortly.”))
and then search for the Error number location.
Thank you very much in advance
Hawki