Hello malkoba,
I have attached a "quick&dirty" example. You can use it as subvi (after some minor changes).
Probably there is a better/faster solution to your problem.
Btw. have you read Labview Development Guidelines, Chapter 6?
Best regards,
GerdW
Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019