Data.Connect.xData
Top  Previous  Next


Connects data in an [xData] section to data in the [Data] section by row numbers

Use Data.Connect.xData to synchronize new data with existing data and for advanced search and replace operations.

Data.Connect.xData compares each row in a single column in the [xData] section with each row in a single column in the [Data] section and, if there is a match - for example a common identifier like name, address, phone number etc. that exists in both [xData] and [Data] - write the [xData] section row number in [Data]. If no match - write 0 (zero).

Typical application:
1.Create an [xData] section with data to replace or add, with one "search for" column that contains already existing data (or at least parts of existing data) and one or more columns with new data  
2.Extract data from the user directory with Data.Get.ND, Data.Get.AD or Data.Get.LD.Find to the [Data] section  
3.Use Data.Connect.xData to search a column in the [Data] section for rows that matches the "search for" column in [xData] and write row numbers of the matching rows in [Data]  
4.In the rest of the script; access the "connected" data in the [xData] section with xDataValue and the row number from [Data].  

Data.Connect.xData works almost the same way as Data.Copy.xData, but instead of copying actual data from [xData] to [Data], the row number of matching [xData] rows is written to the [Data] section.

Why use Data.Connect.xData instead of Data.Copy.xData? (1) If data is to be manipulated in any way before copied it is not possible to use Data.Copy.xData. (2) If there are many columns on each row in [xData] and not all data is to be used for all items it is faster to use the referring row number than to copy all data.

Category
Data section

Script section
[Batch], [Undo], [Init], outside Data.Loop..EndLoop statement

Data.Connect.xData DataRefCol, Criteria

DataRefCol
[Data] section column where row numbers of matching [Data] rows is to be written  

Criteria
Criteria that must be met on each row in order to connect data  
Format: colX=sectionnameY | colX<>sectionnameY  
Where X is a column in the [Data] section, "sectionname" refers to a valid [xData] section, and Y is a column in that section.  
It is possible to use '*' and '?' wildcards before and after the "sectionnameY" part, '*' = any number of characters including none, '?' = any single character.  

Full examples
·Find and replace multiple Linux user attribute values at once  
·Find and replace multiple NetWare user attribute values at once  
·Find and replace multiple Windows user attribute values at once