<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Property to get a structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2b3908158e/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2b3908158e/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/2b3908158e/</id><updated>2020-02-27T14:08:08.312000Z</updated><subtitle>Recent posts to Property to get a structure</subtitle><entry><title>Property to get a structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2b3908158e/?limit=25#a59b" rel="alternate"/><published>2020-02-27T14:08:08.312000Z</published><updated>2020-02-27T14:08:08.312000Z</updated><author><name>JAPIB</name><uri>https://forge.codesys.com/u/japib/</uri></author><id>https://forge.codesys.com5223fecc39d11b46a03147cb9695f8f54c8faca5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I found my error;   &lt;/p&gt;
&lt;p&gt;As the property is a REFERENCE, I have to write "REF=" instead of "=" in the GET acces : &lt;/p&gt;
&lt;p&gt;Property ReadAll : REFERENCE TO ErrorFB1;&lt;br/&gt;
GET&lt;br/&gt;
ReadAll &lt;strong&gt;REF=&lt;/strong&gt;ErrorFB1;  &lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Property to get a structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2b3908158e/?limit=25#d82e" rel="alternate"/><published>2020-02-27T14:08:07.996000Z</published><updated>2020-02-27T14:08:07.996000Z</updated><author><name>JAPIB</name><uri>https://forge.codesys.com/u/japib/</uri></author><id>https://forge.codesys.comeb1d43e627e13b079d2f3c4c17660836d1710565</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I have a little problem with property. (I use CODESYS V3.5 SP14)&lt;/p&gt;
&lt;p&gt;I writted an objet FB1&lt;br/&gt;
&lt;strong&gt;FB1 Function blockVARErrorFB1: Struct1;END_VAR&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I use MyFB1 :&lt;br/&gt;
&lt;strong&gt;VAR_GLOBALMyFB:FB1;END_VAR&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Struct1 is a structure, declared like this : &lt;br/&gt;
&lt;strong&gt;Struct1:ErrorBit1:BOOL;ErrorBit2:BOOL;Error_Code:INT;END_STRUCT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I can write 3 properties to get the value of each variable ErrorFB1.ErrorBit1, ErrorFB1.ErrorBit2, .... wtih properties like this :&lt;br/&gt;
&lt;strong&gt;Property Read1 : Bool;GETRead1:= ErrorFB1.ErrorBit1&lt;/strong&gt;;&lt;/p&gt;
&lt;p&gt;It works well.&lt;/p&gt;
&lt;p&gt;But I try to write only one property to get the entire structure ErrorFB1 :&lt;br/&gt;
&lt;strong&gt;Property ReadAll : ErrorFB1;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;but It don't work.&lt;/p&gt;
&lt;p&gt;I read somewhere, that I have to declare a REFERENCE, so I wrote :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Property ReadAll : REFERENCE TO ErrorFB1;GETReadAll :=ErrorFB1;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In my programme I use :&lt;br/&gt;
&lt;strong&gt;Default1:=MyFB.ReadAll;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And I get an exception when I run the simulation mode.&lt;/p&gt;
&lt;p&gt;I am a beginner in the use of OOP. I looked for examples but  I founded only "simple" one.&lt;br/&gt;
I have certainly made a monstrous mistake somewhere, but I do not see it   &lt;/p&gt;
&lt;p&gt;Thank you in advance for any help. &lt;br/&gt;
BR&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>