1

I'm trying to make CAPL associative array which could hold e.g. 10 most recent CAN messages for each ID like below:

message[10] messages[long]

Is there possibility to make associative array in CAPL, where key would be some integral type value, and value would be array of messages?

Juhas
  • 178
  • 2
  • 13
  • There is nothing called as associating table in CAPL. What is your use case here? – Shyam Apr 07 '21 at 10:18
  • 1
    It's called associative arrays. Have a look here e.g.: [link](https://stackoverflow.com/a/55207365/4866709) – seesharp Apr 08 '21 at 13:07
  • Hello, thanks for the indication - changed the name of it. Use case is to store most recent messages with unique CAN IDs in order to pass it to external script. – Juhas Apr 08 '21 at 20:17

2 Answers2

1

The data type message is an object. Since only "simple data types" are possible, you cannot declare a message variable with associative fields.

Shyam
  • 649
  • 1
  • 5
  • 20
1

According to https://blog.csdn.net/qq_34414530/article/details/126055577 the data types of key and value can be: long, int64, float, double, enumeration types and char[]. In that case you can not declare an associative array with key of data type message.

gedomagno
  • 13
  • 5
  • Could you add an English language link to your answer? The link you posted is in Chinese. In general, prefer original documentation links when you can because there is a possibility any other link/post may get deleted in future. Thank you – Anon Jan 15 '23 at 11:32
  • Hi Anon. The original post is in Chinese, it seems that it is a blog from Ant Minion. I could not find an English version and also I can not Chinese. I just used the translator in the web browser (Chrome). Thank you – gedomagno Jan 16 '23 at 12:38