-1

I'm writing a piece of code to simulate some stuff of diagnostic.

I've created with CANalyzer, a panel with tons of information that need to be shown using a picklist (called combobox)

This is the panel I've created

This is the struct that I've created using the System Variables panel in CANalyzer

What I want to do is to create a giant array of that struct that need to be selected using the SPN combobox (the picklist) , and the other parameters of the struct/object need to populate the other elements of the panel.

Is this possible without doing a tons of SysSetVariableInt or SysSetVariableString for each element?

Before I was doing this stuff using another technique, I parse the file with all the information that are stored in a giant matrix, then I use the method "on sysvar update" on the variable associated to the SPN picklist, to get the index of that, so I search for that index in the matrix, then I use the SysSetVariableInt or others, to set the values to the elements in the panel.

To populate the picklist I've found a pretty nice method "sysSetVariableDescriptionForValue" that helps to add elements, but the problem with this method, is that if you want to change elements, you can just overwrite, and not change all...so, if in a next iteration you push less element in the picklist, you will see also the old ones.

With "sysSetVariableDescriptionForValue" you basically are writing via code, the value table of that sysvariable, and is not possible (according to Vector), be flushed, on runtime... :/

I would love to do this thing using another approach, maybe with the struct is possible...i really don't know.

Any help will be very appreciated!

Regards!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jonsey
  • 39
  • 7
  • looks like you are looking for a lookup table. You know all the possible values, just code them into a lookup and load the pairs you need when you need them. In any case, reading your post is painful. Could you please polish it up? Reduce text so that only important info are said. Avoid too many adjectives. _Do not post code as pictures_ but post some code. You already did this in the past, maybe we can re-use it if you would be so kind to share. Use code formatting in inline text. – Daemon Painter Feb 08 '21 at 15:07
  • ciao Daemon, the problem is that i've about 700 elements to add into the value table. I've wrote to the Vector support and they don't have any other solution. I've used the method "sysSetVariableDescriptionForValue("DiagnosticPanel","Diag_SPN", t, string);" to add dinamically all the stuff into the value table...with the all already known limitations (can't be deleted, just overwritten) – jonsey Feb 12 '21 at 09:23

1 Answers1

1

TLDR; build a tool to create a .sysvar file from a structured input (comma-separated for instance), run it, get the .sysvar file and link it to the CANalyzer configuration.


I once had to create the entire testing interface with some components of the software. We didn't have a structured release procedure, and the test environment was rebuilt every time from scratch based on the new internal software interfaces. I too had to add hundreds of variables.

My solution was to generate .sysvar files programatically outside CANalyzer. Links to the .sysvar files are symbolic in the CANalyzer configuration, meaning if a file by the right name is in the right location, that file is going to be loaded.

What I want to do is to create a giant array of that struct that need to be selected using the SPN combobox (the picklist) , and the other parameters of the struct/object need to populate the other elements of the panel. Is this possible without doing a tons of SysSetVariableInt or SysSetVariableString for each element?

Create an external script to generate the .sysvar file. In the end it is just an xml file, you may study the structure of a demo one you save. Then, import that file in the CANalyzer config. You may need to close/re-open the configuration in case the .sysvar file changes.

PROs: no need to write a complicated CAPL script and update it every time a variable changes.

CONs: you must have a source for all the information, even a simple excel sheet, with all the description and such, and you have to create a tool that accepts the input file (let's assume a .csv file) and turns it into a .xml file with .sysvar extension instead.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Daemon Painter
  • 3,208
  • 3
  • 29
  • 44