Posted 26 Feb 2018 Hello, I am trying to define a struct as an input variable for a Function or Function Block. For example the function AddDelimiter (This is a standard Sysmac function), has a input variable with the variable type Struct, an it is possible to couple a struct to this input (See picture below). If i try to make my own function block with a struct or Structure as an input data type, i get the following error (See picture below). When I try to define a struct from the data types (In this case struct: Test) it doesn't give a error. But when I try to couple a struct to this input, that is a layer deeper than the function block struct i get the following error (See picture below). How can i define a struct as an function/ function block input? Thanks in advance. Share this post Link to post Share on other sites
Posted 26 Feb 2018 (edited) 1 hour ago, Alex Teeuwen said: But when I try to couple a struct to this input, that is a layer deeper than the function block struct i get the following error (See picture below). How can i define a struct as an function/ function block input? Thanks in advance. Hi, your problem here is that you are defining two different datatypes. One is Test_Struct and one is Test_Struct1. Your FB Input (the Input_Structuur) requires Test_Struct datatype, but you give it Test.Test1 variable which has a datatype of Test_Struct1. That's why the error pops up. I'm just assuming here, that you are having a variable called Test whose datatype is Test_Struct, and it has a member Test1 whose datatype is Test_Struct1. In that case you just need to put Test as the input of your FB. 1 hour ago, Alex Teeuwen said: If i try to make my own function block with a struct or Structure as an input data type, i get the following error (See picture below). For a user-defined Functions / Function Blocks, you cannot use the elementary STRUCT as the datatype. This functionality is only for Omron's premade libraries. You need to specify a certain Structure name for your FB Inputs/Outputs. Should you export this function block later on for different project, this Struct Datatype information will be carried along in the namespace of the FB. Edited 26 Feb 2018 by innoaloe Share this post Link to post Share on other sites
Posted 26 Feb 2018 Dear Innoaloe, Thanks for your reply. I know that i coupled the wrong variable to my function block, I wanted to test if a nested struct would couple to this input, and that is not the case. The problem is that I want to be able to couple any struct to my function block, just like the AddDelimiter function, is it possible to create a input with the data type Struct? Thanks in advance. Share this post Link to post Share on other sites
Posted 26 Feb 2018 I explained in the post above already. Basically no, you can't Share this post Link to post Share on other sites