Get Address ID
Last Modified: February 25, 2024 18:18 CEST

Get-AddressId #

SYNOPSIS #

This PowerShell function returns the ID of an address based on its unique field like addressMatch, addressId or addressUid of the EULANDA merchandise management system. This function requires an EULANDA ERP system. Source code on GitHub.

SYNTAX #

Get-AddressId [[-addressMatch] <String>] [[-addressId] <Int32>] [[-addressUid] <Guid>] [-like]
 [[-conn] <Object>] [[-udl] <String>] [[-connStr] <String>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION #

The function returns the id of the address using the parameter Match. The field Match is unique in the address table. Via the switch like it can be achieved that the parameter Match is considered as search word*. This can be useful in certain scenarios. Alternatively, the ID can be set instead of the Match parameter. In this case the function returns the same value if the record could be found. If no value is found, $null is returned, otherwise the found Id. If more than one address is found when using the like switch, an exception is thrown.

EXAMPLES #

PS C:\> Get-AddressId -match 'JOHN' -like -udl "C:\temp\Eulanda_1 JohnDoe.udl"

Here the ID of the desired address is returned, even if the address would be stored in the database as ‘JOHN DOE’, because the like-switch allows this variant of the search.

PARAMETERS #

-addressId #

The AddressId is a unique key in the table. It is usually used only internally to link tables together. Although the function already returns the ID, it can still be useful to search for it, specifically to determine if the ID is valid and a record can be found with it.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-addressMatch #

The parameter -addressMatch is a match code in the EULANDA ERP system, which also serves as a search term but as a unique search field. It is practical because it is easily readable and understandable, and is often used to compare data with external systems. The match code is used to search for a specific address, to ensure that the searched address is unique and valid.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-addressUid #

A UID (Unique Identifier) is a unique identifier assigned to a specific record in a database. In the context of EULANDA ERP software, each article is assigned a UID to uniquely identify it, regardless of its name, number, or other properties. The UID is usually automatically generated by the database and has a fixed length and formatting to ensure its uniqueness. The addressUid parameter is used to specify the UID of the address to retrieve the record.

Type: Guid
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-conn #

The connection can be established via an existing ADO object of the type ‘ADODB.Connection’. If the connection is already open, it remains open even after the function has been executed. If it was closed, it will be closed again after the function has been executed.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-connStr #

A ConnectionString can be specified here, with which a database can be opened.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-like #

The switch like specifies that the address is to be fuzzy searched using the Match field. The beginning of the match must be exact, the remaining part is a wildcard, e.g. ‘Match*’.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-udl #

Alternatively to a connection, a string to a UDL file can be specified. In this case an ADO object is created and closed again at the end of the function.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters #

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS #

None #

OUTPUTS #

System.Object #

NOTES #