8/13/2012 3:25 PM | |
Joined: 10/7/2005 Last visit: 5/24/2024 Posts: 3007 Rating: (1049)
|
Hello UselessChimp the "problem" is that complex data types (e.g. Date_and_Time, String, Array, Struct and UDT's) arepassed over to the Function as a 6 Byte long Pointer which you now have to pull apart inside the Function. To be precise, the 6 Byte long Pointer value resides in the Local data (TEMP variables) of the calling Block, aka "V memory" (which is also whatAR2indicates in your example). To get to values inside the Array, do the following: L P#ExtElements // Start adress of 6 byte long pointer in V memory LAR1 LW [AR1,P#0.0] //Get DB numberfrom Pointer T #DB_Number // store inTEMP variable OPN DB [#DB_Number] // Open DB LD [AR1,P#2.0] //Get Start address of Array LAR1 // load start address into AR L W [AR1,P#0.0] // load value of first Word in Array L W [AR1,P#2.0] // load value of secondWord in Array L W [AR1,P#4.0] // load value of thirdWord in Array etc. I hope this helps and have a look too at theHow do you parameterize a structured data type in the IN_OUT area of an FB and a function call with an ARRAY variable? FAQ which has more on this (and also shows how to take AR2 into account in case an FB is used). |
Cheers |
|
This contribution was helpful to3 thankful Users |
Follow us on