[BM V8i SS4] SQL command controled by GUI toggle (operation feature)?

Hi,

I have Bentley Map project, XFM features in DGN with mslinks to SQL Server 2014 (hybrid DGN + DB project).

Source problem is that I need to place a feature (cell) in two different modes:

  • When feature is placed, a new row is created in SQL Server database. It's deafult mode and it works fine.
  • More often, the record is created using form application and not from BM, so the row exists already. In such case, I need to place cell and to set DB connection (mslink) to existing record. It seems to be a problem.

Is anybody aware of some simple solution?

After some testing, I want to try an idea to have two different Insers SQL commands, one original with INSERT (new row is created) and second with UPDATE. They would be controlled by Criteria what SQL command will be sent to database.

Unfortunately I am not able to test this approach, because I am not able to find a way how to control the queries and select one only.

The project is huge and requires specifically configured dabase, but what I did in a simplified and anonymized form:

  • There is operation property "InsertNewRecord"
  • The property is inserted into Place feature dialog
  • The feature is set accordingly to this older discussion I found.
  • I can see in XFM debug output that the property is set properly True or False
  • I have also criteria defined as COMPARE("[MyFeature/InsertNewRecord]", "True", "") and also opposite one.
  • These criterias are used in feature SQL Statements > Inserts.

Now the situation is that no SQL command is sent to database, so it seems both criteria are evaluated as not valid.

Is it possible to test somehow whether the problem is in the criteria (e.g. wrongly defined) or e.g. it's bug when criterion using operation feature is set for SQL statement, it's not evaluated?

With regards,

  Jan

Parents
  • Hello Jan,

    Try using a feature property instead of an operation property for the SQL statement criteria.

    In the attached simple example, a feature combo box property with a SQL domain list allows selection of an existing record. I ran this example with Map Connect.

    After starting Widget placement, the user may enter a new Widget name or choose an existing Widget name from a combo box.   The combo box is defined by a feature property “ExistingRowId” which has a SQL domain list. Note that I manually edited the XFM schema to set “ExistingRowId” property with attribute dbProp=”true” since the toggle button is read-only in the Geospatial Administrator user interface. I set this attribute so that the property is not written to the design file with the feature instance.

     

    If “ExistingRowId” property has a value, then the insert statements are not executed and the DB linkage is built using the existing row mslink value.

    If “ExistingRowId” property does not have a value, then the insert statements are executed and the DB linkage is built using the next available mslink value.

     

     <insertList>

     <insert useCriteria="!strlen(&quot;[ExistingRowId]&quot;)">INSERT INTO widget (MSLINK,name) VALUES ([widgetMslink=XFMNextMslink("widget")],'[name|NULL]')</insert>

    <insert useCriteria="!strlen(&quot;[ExistingRowId]&quot;) &amp;&amp; XFMIsAutoCommitOff()">COMMIT</insert>

     </insertList>

     <dbLinkList>            

    <dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="!strlen(&quot;[ExistingRowId]&quot;)">[widgetMslink]</dbLink>            

    <dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="strlen(&quot;[ExistingRowId]&quot;)">[ExistingRowId]</dbLink>          

    </dbLinkList>

    existingDBRecord.zip

    Regards,

    Chris


    This is a test

Reply
  • Hello Jan,

    Try using a feature property instead of an operation property for the SQL statement criteria.

    In the attached simple example, a feature combo box property with a SQL domain list allows selection of an existing record. I ran this example with Map Connect.

    After starting Widget placement, the user may enter a new Widget name or choose an existing Widget name from a combo box.   The combo box is defined by a feature property “ExistingRowId” which has a SQL domain list. Note that I manually edited the XFM schema to set “ExistingRowId” property with attribute dbProp=”true” since the toggle button is read-only in the Geospatial Administrator user interface. I set this attribute so that the property is not written to the design file with the feature instance.

     

    If “ExistingRowId” property has a value, then the insert statements are not executed and the DB linkage is built using the existing row mslink value.

    If “ExistingRowId” property does not have a value, then the insert statements are executed and the DB linkage is built using the next available mslink value.

     

     <insertList>

     <insert useCriteria="!strlen(&quot;[ExistingRowId]&quot;)">INSERT INTO widget (MSLINK,name) VALUES ([widgetMslink=XFMNextMslink("widget")],'[name|NULL]')</insert>

    <insert useCriteria="!strlen(&quot;[ExistingRowId]&quot;) &amp;&amp; XFMIsAutoCommitOff()">COMMIT</insert>

     </insertList>

     <dbLinkList>            

    <dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="!strlen(&quot;[ExistingRowId]&quot;)">[widgetMslink]</dbLink>            

    <dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="strlen(&quot;[ExistingRowId]&quot;)">[ExistingRowId]</dbLink>          

    </dbLinkList>

    existingDBRecord.zip

    Regards,

    Chris


    This is a test

Children