Quantcast
Channel: OpenCities Map Wiki
Viewing all articles
Browse latest Browse all 1284

- Date field settings for use with PBA in SQL Server

$
0
0
Current Revision posted to Bentley Map | OpenCities Map Wiki by Inga Morozoff on 11/18/2019 6:39:28 PM

PBA text replacement for SQL Server dates

The following discusses how to replace date fields in queried SQL Server features that are being placed as a cell.

communities.bentley.com/.../03-_2D00_-SQL-Server-Date-_2D00_-Replacement-Text.mp4

A cell is created and specified in the Symbology tab of the Symbology node. In this example, the text values [DATE_ADDED] and [DATE_EDITED] are used as placeholders for the database date properties.

Note: There is no formatting associated with date fields in SQL Server. The display of the date is controlled by the application getting the dates from the database.


 

When SQL Server features are registered, date properties are set as follows:


 

For the Date_Edited property, an Editing key was added and set to dateTimeTicks. This enables Bentley Map to extract the current date and apply it to this field when the feature is edited.


 

The display format can be changed to any number of valid formats as described in the following table:


Format

Description

d

The one- or two-digit day.

dd

The two-digit day. Single-digit day values are preceded by a 0.

ddd

The three-character day-of-week abbreviation.

dddd

The full day-of-week name.

h

The one- or two-digit hour in 12-hour format.

hh

The two-digit hour in 12-hour format. Single digit values are preceded by a 0.

H

The one- or two-digit hour in 24-hour format.

HH

The two-digit hour in 24-hour format. Single digit values are preceded by a 0.

m

The one- or two-digit minute.

mm

The two-digit minute. Single digit values are preceded by a 0.

M

The one- or two-digit month number.

MM

The two-digit month number. Single digit values are preceded by a 0.

MMM

The three-character month abbreviation.

MMMM

The full month name.

s

The one- or two-digit seconds.

ss

The two-digit seconds. Single digit values are preceded by a 0.

t

The one-letter A.M./P.M. abbreviation (A.M. is displayed as “A”).

tt

The two-letter A.M./P.M. abbreviation (A.M. is displayed as “AM”).

y

The one-digit year (2001 is displayed as “1”).

yy

The last two digits of the year (2001 is displayed as “01”).

yyyy

The full year (2001 is displayed as “2001”).


When defining text replacement, you may find yourself inserting Simple Replacement Text for date properties. This will result in date ticks being used rather than properly formatted date fields.


 


 

To overcome this, select PBA Replacement Text instead of a Simple Replacement Text.

 

 

The Value field can be any text string and is used to identify the replacement text. In this example, Date_Added and Date_Edited are used.


 

In the Details section, the Old Text is defined as the text to replace. In this example, its [DATE_ADDED] and [DATE_EDITED] in the cell that will be placed during the query process.



 

Details for Date_Added property:


 

Details for Date_Edited property:



 

When the replacement text has been defined, the associated PBA needs to be created.

This is done by highlighting the Replacement Text key and selecting Insert > PBA (Expression) from the right click menu.


 

A new PBA key is inserted above the Replacement Text. The value of the PBA key is edited from the default [Expression] to the name of the feature property being replaced. Note that the property name must be enclosed in square brackets as shown:


 

Finally, in the PBA Details, change the default Name New to the value of the Replacement Text key.   In this example, it’s Date_Added and Date_Edited.  The Type value will remain as a PBA Expression.

 

Date Added PBA Details:


 

Date Edited PBA Details:


 


 

 

When placing new features, the Date Added and Date Edited fields are automatically set to the current date:

 

 

However, they can be set manually as well:


 

Finally, when queried features are edited, the Date Edited field will automatically update to capture the current date:

 

 

 

communities.bentley.com/.../SQL-Date-Replacement.pdf  Download the PDF

 communities.bentley.com/.../SQL-Server-Date.zip

Attached is the project schema which you can use for learning.

- modified the Wiki category, 07/06/201

Tags: PBA, DateTimeTicks, Replacement Text, Geospatial Administrator, Date Field, Bentley Map, schema, GSA

Viewing all articles
Browse latest Browse all 1284

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>