XUField Class |
Code of field: U (for URL)
Type of field: List of hyperlinks pointing to websites.
Applicable to:
Websites containing useful information on a given record can be pointed and opened with U fields.
Namespace: Biolomics.BioCallback
The XUField type exposes the following members.
Name | Description | |
---|---|---|
XUField(XUField) |
Copy ctor
| |
XUField(TUField, XRecord) |
Initializes a new instance of the XUField class.
| |
XUField(XUField, XRecord) |
Copy ctor but into a new XRecord
|
Name | Description | |
---|---|---|
FieldValue |
Gets or sets the field value.
(Overrides XFieldFieldValue.) | |
IsModified |
Gets or sets a value indicating whether this instance is modified.
(Inherited from XField.) | |
NameUrl |
Gets or sets the name URL.
|
Name | Description | |
---|---|---|
AddValue |
Adds a new URL value.
| |
CanRead |
Determines whether current connection can read from Field.
(Inherited from XField.) | |
CanWrite |
Determines whether current connection can write from Field.
(Inherited from XField.) | |
Clear |
Clears this instance.
(Inherited from XField.) | |
Clone |
Clones this instance.
| |
CloneAsXField |
We cannot use name 'Clone' here otherwise Implements vector.TId(Of XSField) fails because XSField.Clone() returns a XField instead of a XSField !!!
(Overrides XFieldCloneAsXField(XRecord).) | |
DataToView |
Converts field value to readable string.
(Inherited from XField.) | |
DataToView(Int32) |
Mandatory otherwise DataToView(5) returns letter 5 of string given by DataToView(), instead of the subfield value
(Inherited from XField.) | |
DeleteValue |
Deletes Url by index.
| |
Equals |
Determines whether the specified Object is equal to this instance.
(Inherited from XField.) | |
Field |
each derived class embed its own TField member, which can be a TAField, TCField, TEField, etc.
this function must return that original TField
(Overrides XFieldField.) | |
FieldDef |
Gets the Field definition.
(Inherited from XField.) | |
FieldType |
The Field type.
(Inherited from XField.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
Find |
Finds the specified name.
| |
FindUrlByName |
Finds the URL by name.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Key |
Gets Field Key.
(Inherited from XField.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ParentRecord |
Gets the parent record.
(Inherited from XField.) | |
Read |
Reads the Content from source object.
(Inherited from XField.) | |
Reset |
Resets this instance.
(Inherited from XField.) | |
SetDefaultValues |
Sets the default values.
(Inherited from XField.) | |
SortByName |
Sorts Urls by name.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UrlList |
Gets the URL list.
| |
Write |
Writes data into a TQuery
and Format it depending to field type
(Inherited from XField.) |
Imports System Imports BioloMICS.BioCallback Imports BioloMICS.SharedClasses Imports Biolomics.Utility.DatabaseConstants Public Class Program <STAThread()> Shared Sub Main() Dim program As New Program program.ChangeField() End Sub ' Write sub functions here Public Sub ChangeField() ' get the current connection Dim SqlCo As XConnection = Run.GetCurrentConnection() If SqlCo Is Nothing Then Return End If ' get a table from its User name Dim TableDef As XTableDef = SqlCo.GetTableDefByUserNameEng("Your_Table_Name") If TableDef Is Nothing Then ' may happen if that table doesn't exist Return End If ' load a Field from that table Dim FieldDefMap As New XFieldDefMap Dim FieldDef As XFieldDef = SqlCo.GetFieldByDBName("Your_U_Field_name", TableDef.Key) If FieldDef Is Nothing Then ' that field doesn't exist Return End If FieldDefMap.Add(FieldDef) ' load record with id=6 Dim Where As XWhere = XWhere.Eq(StaticFields.id, 6) Dim RecordMap As XRecordMap = Run.LoadRecords(TableDef.Key, FieldDefMap, Where) For Each Record As XRecord In RecordMap Dim Field As XUField = TryCast(Record.Fields(FieldDef.Key), XUField) If Field Is Nothing Then ' this field doesn't exist or is not a U-Field Continue For End If For Each item As XNameUrl In Field.UrlList ' fill in the field name if missing If item.Name.Length = 0 Then If item.Url.Length = 0 Then ' both are empty ! Continue For End If If item.Url.Length > 16 Then item.Name = item.Url.Substring(0, 16) ' copy part of the url into the name Field.IsModified = True ' notify the parent field for any change in a subitem Else item.Name = item.Url ' copy the url into the name Field.IsModified = True End If End If ' check URL If item.Url.Length >= 4 AndAlso item.Url.Substring(0, 4).ToLower = "www." Then ' URL starts with "www.", insert "http://" item.Url = "http://" & item.Url Field.IsModified = True ElseIf item.Url.Length >= 11 AndAlso item.Url.Substring(0, 11).ToLower <> "http://www." Then ' insert "http://www." item.Url = "http://www." & item.Url Field.IsModified = True End If Next Record.Save(False) Next End Sub End Class