<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/</id><updated>2025-12-12T12:53:10.958000Z</updated><subtitle>Recent posts to VAR_INFO from inside of a FB to get info on the instance.</subtitle><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#2c5d" rel="alternate"/><published>2025-12-12T12:53:10.958000Z</published><updated>2025-12-12T12:53:10.958000Z</updated><author><name>durallymax</name><uri>https://forge.codesys.com/u/durallymax/</uri></author><id>https://forge.codesys.comb2f05c2aceba7e8bbc949767ade8c904efa72214</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The help link appears to be broken. &lt;/p&gt;
&lt;p&gt;When I implemented something similar I had to add {attribute 'reflection} above the declaration of the FB with {attribute 'instance-path'} above the string VAR that would contain the path. Then wrote a function to trim off however much I wanted removed by searching for periods, then formatting it with spaces at the periods and removing brackets on arrays while also breaking up the PascalCase to present it a bit nicer for the end-users.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#914b/be8b" rel="alternate"/><published>2025-12-04T13:34:56.571000Z</published><updated>2025-12-04T13:34:56.571000Z</updated><author><name>mbart</name><uri>https://forge.codesys.com/u/mbart/</uri></author><id>https://forge.codesys.comfe6a8623325a2d3d1deaee4519ae8ec718eaa297</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I experienced the same problem: using __VARINFO is working only in PRG context, while it &lt;strong&gt;crashes if used inside Function Blocks&lt;/strong&gt;. I would really appreciate if they would fix this issue&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#b87d" rel="alternate"/><published>2020-02-27T14:06:14.808000Z</published><updated>2020-02-27T14:06:14.808000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comadd7024d95b228482cfa67147ff79ff464b02240</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;Those items you don’t want are part of the instance path, that is why they are included.  Simply make a function that starts at the string end, and goes backwards until it finds the second period. Then return the MID of the string, starting at that point.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#f7d7" rel="alternate"/><published>2020-02-27T14:06:14.511000Z</published><updated>2020-02-27T14:06:14.511000Z</updated><author><name>yannickasselin1</name><uri>https://forge.codesys.com/u/yannickasselin1/</uri></author><id>https://forge.codesys.com8cc9e88a88e38f949636f4929d4314320aedab6b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;It works but I also get the name of the TC project and the name of the PLC project in front of the variable name. I should be able to figure a way to get rid of what I don't need using some string functions.&lt;/p&gt;
&lt;p&gt;'Tc3_TestRecipe.PLC_TestRecipe.Main.fbTest&lt;span&gt;[0]&lt;/span&gt;'&lt;/p&gt;
&lt;p&gt;I only need 'Main.fbTest&lt;span&gt;[0]&lt;/span&gt;'&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#c73e" rel="alternate"/><published>2020-02-27T14:06:14.215000Z</published><updated>2020-02-27T14:06:14.215000Z</updated><author><name>singleton</name><uri>https://forge.codesys.com/u/singleton/</uri></author><id>https://forge.codesys.com71e45aafa3c7cd56ebc0807cb732199cac87238d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If you just want to have the instance name you can use this attribute pragma:&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://help.codesys.com/webapp/_cds_pragma_attribute_instance_path;product=codesys;version=3.5.15.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_pr ... n=3.5.15.0&lt;/a&gt; m &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>VAR_INFO from inside of a FB to get info on the instance.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/693c224dd6/?limit=25#914b" rel="alternate"/><published>2020-02-27T14:06:13.248000Z</published><updated>2020-02-27T14:06:13.248000Z</updated><author><name>yannickasselin1</name><uri>https://forge.codesys.com/u/yannickasselin1/</uri></author><id>https://forge.codesys.com5e53a4fe1567541533af639e26d4fdf9ed6f59d2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is it possible to use __VARINFO inside a Function block to get info on the instance of the function block like this:&lt;/p&gt;
&lt;p&gt;stVarInfo := __VARINFO(THIS^);&lt;/p&gt;
&lt;p&gt;If I do this in TwinCat, VisualStudio crashes.  I would like to get the name of the instance of the function block from inside the function block.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>