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:
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:
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
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("[ExistingRowId]")">INSERT INTO widget (MSLINK,name) VALUES ([widgetMslink=XFMNextMslink("widget")],'[name|NULL]')</insert>
<insert useCriteria="!strlen("[ExistingRowId]") && XFMIsAutoCommitOff()">COMMIT</insert>
</insertList>
<dbLinkList>
<dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="!strlen("[ExistingRowId]")">[widgetMslink]</dbLink>
<dbLink table="widget" linkType="OLEDB" infoProp="false" useCriteria="strlen("[ExistingRowId]")">[ExistingRowId]</dbLink>
</dbLinkList>
existingDBRecord.zip
Regards,
Chris
Hi Crhis,
thanks a lot for your asnwer, I will study it and will let you know whether it works and can be used in the project.
In parallel I have discussed with the customer an option to split the table into two separate, one to be linked from DGN and second to be used by another application.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point