﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Strong typed reference to BO field</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Fri, 26 Jun 2026 02:50:05 GMT</lastBuildDate><ttl>20</ttl><item><title>Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23551.aspx</link><description>I have a list of field names in a database. I want to get a programatic reference to the corresponding field property on the BO so I can set its value. How?</description><pubDate>Fri, 19 Jun 2009 08:28:58 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23603.aspx</link><description>Looking at your code, why can't you just use the CurrentRow property.  &lt;br&gt;
&lt;br&gt;
Instead of:&lt;br&gt;
&lt;br&gt;
[codesnippet]Dim x As DataTable = Me.Bo_consignee1.CurrentDataTable&lt;br&gt;
Dim y As DataRow = x.Rows.Item(bo.CurrentRowIndex)&lt;br&gt;
y.Item(sqlField) = v[/codesnippet]&lt;br&gt;
&lt;br&gt;
Use: &lt;br&gt;
&lt;br&gt;
[codesnippet]Bo_consignee1.Item(sqlField) = v[/codesnippet]&lt;br&gt;
&lt;br&gt;
There is nothing wrong with this approach.  I will do this a fair amount myself at times.</description><pubDate>Fri, 19 Jun 2009 08:28:58 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23593.aspx</link><description>I&amp;nbsp;got this to work by modifying the underlying datatable, I would rather use the BO field properties.&lt;/P&gt;&lt;P&gt;Background on the why: I have a need to convert VFP tables to SQL, the target structures will be a moving target so I came up with a system that allows you to map VFP fields to SQL fields, and apply any conversion rules that need to be applied. These mapping rules are stored in a table so they can be modified and re-run as many times as needed as the process evolves and the target tables structures change.&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;For&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Each&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; row_conversionrule &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; BUSINESS.bo_mapfields &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;In&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Bo_mapfields.GetEnumerable()&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; sqlField &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; = row_conversionrule.mapf_sqlfield&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; s &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; vfpField &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; = row_conversionrule.mapf_vfpfield&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; v &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;s = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Bo_consignee1.Item(sqlField)&lt;/P&gt;&lt;P&gt;v = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Vfpbo_consig1.Item(vfpField)&lt;/P&gt;&lt;P&gt;s = v ' only changes the string object values, not the BO field value&lt;/P&gt;&lt;P&gt;'workaround below&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; x &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; DataTable = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Bo_consignee1.CurrentDataTable&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; y &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; DataRow = x.Rows.Item(bo.CurrentRowIndex)&lt;/P&gt;&lt;P&gt;y.Item(sqlField) = v&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Next&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Thu, 18 Jun 2009 12:36:05 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23589.aspx</link><description>almost... In your example above I want to use r to set the value of the bo.field to something, not just read the data value</description><pubDate>Thu, 18 Jun 2009 11:41:54 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23565.aspx</link><description>I understand...glad to help!</description><pubDate>Wed, 17 Jun 2009 16:14:56 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23554.aspx</link><description>Exactly what&amp;nbsp;I wanted. Lots of collections, picking the right one is the trick :)</description><pubDate>Wed, 17 Jun 2009 14:15:05 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Strong typed reference to BO field</title><link>http://forum.strataframe.net/FindPost23553.aspx</link><description>So you have a string with a field name in it, correct?  And you want to retrieve the data from that field on the BO?  For example:&lt;br&gt;
&lt;br&gt;
[codesnippet]Dim myField As String = "cust_FirstName"&lt;br&gt;
Dim r As Object&lt;br&gt;
&lt;br&gt;
r = MyBO.Items(myField)[/codesnippet]&lt;br&gt;
&lt;br&gt;
Or are you wanting to use reflection and actually get to the FieldPropertyDescriptor?</description><pubDate>Wed, 17 Jun 2009 13:16:49 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>