Daniel_EWW Posted July 14, 2020 Report Share Posted July 14, 2020 I like to link different Data Tables (Indexed) to one Function as IN parameter. Has someone done this already? What I'm doing wrong? (Please see example Function1 Rung 1; Direct linking is possible Function1 Rung 2) Quote Link to comment Share on other sites More sharing options...
ORSO2001 Posted July 14, 2020 Report Share Posted July 14, 2020 hi Daniel_EWW, i think that the "problem" is that the DT_Index as FunctionIn variable is not able to define the type/lenght of sructure that it is referring (seems somthing like late binding)...then is not able to let you select the right local or global structure variable to store the "value". Quote Link to comment Share on other sites More sharing options...
Daniel_EWW Posted July 14, 2020 Author Report Share Posted July 14, 2020 hi ORSO2001, thanks for you answer. i think i understand what you mean. but it is possible to define a struct as FunctionIn without problem. a data table is (in my understanding) a struct with a row index. Quote Link to comment Share on other sites More sharing options...
Saragani Posted July 14, 2020 Report Share Posted July 14, 2020 A data Table is an array of structs in that matter. The only way, currently, to work with a Data Table that is passed to a function is the function is a C function, and then work with pointers in order to read and write data from that table. It is not a nice code, and I know someone from another department in our company that did that. And there is also a limitation. The C function knows the type of the struct that is used in the data table. It is not like you can define a generic function that can work with any data table structure.... It just let you pass the Data Table as a reference (so if you have 2 tables of the same struct, then you can pass a different table each time). Quote Link to comment Share on other sites More sharing options...
Daniel_EWW Posted July 15, 2020 Author Report Share Posted July 15, 2020 Saragani, please can you share an example C- code function to pass on a Data Table as reference? Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.