![]() |
VOOZH | about |
The CData Cmdlets for Wave Financial are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to Wave Financial.
The Cmdlets are not only a PowerShell interface to Wave Financial, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete Wave Financial data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Wave Financial. To access Wave Financial data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Wave Financial.
Once you have acquired the necessary connection properties, accessing Wave Financial data in PowerShell can be enabled in three steps.
You can connect to Wave Financial by specifying the APIToken You can obtain an API Token using the following steps:
If you wish, you can connect using the embedded OAuth credentials. See the Help documentation for more information.
Install the module:
Install-Module WaveFinancialCmdlets
Connect:
$wavefinancial = Connect-WaveFinancial -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$status = "SENT" $invoices = Select-WaveFinancial -Connection $wavefinancial -Table "Invoices" -Where "Status = `'$Status`'" $invoices
You can also use the Invoke-WaveFinancial cmdlet to execute SQL commands:
$invoices = Invoke-WaveFinancial -Connection $wavefinancial -Query 'SELECT * FROM Invoices WHERE Status = @Status' -Params @{'@Status'='SENT'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Wave Financial\lib\System.Data.CData.WaveFinancial.dll")
Connect to Wave Financial:
$conn= New-Object System.Data.CData.WaveFinancial.WaveFinancialConnection("InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the WaveFinancialDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, DueDate from Invoices"
$da= New-Object System.Data.CData.WaveFinancial.WaveFinancialDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.duedate
}
Update-WaveFinancial -Connection $WaveFinancial -Columns @('Id','DueDate') -Values @('MyId', 'MyDueDate') -Table Invoices -Id "MyId"
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("UPDATE Invoices SET Status='SENT' WHERE Id = @myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myId","10456255-0015501366")))
$cmd.ExecuteNonQuery()
Add-WaveFinancial -Connection $WaveFinancial -Table Invoices -Columns @("Id", "DueDate") -Values @("MyId", "MyDueDate")
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("INSERT INTO Invoices (Status) VALUES (@myStatus)", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myStatus","SENT")))
$cmd.ExecuteNonQuery()
Remove-WaveFinancial -Connection $WaveFinancial -Table "Invoices" -Id "MyId"
$cmd = New-Object System.Data.CData.WaveFinancial.WaveFinancialCommand("DELETE FROM Invoices WHERE Id=@myId", $conn)
$cmd.Parameters.Add((New-Object System.Data.CData.WaveFinancial.WaveFinancialParameter("@myId","001d000000YBRseAAH")))
$cmd.ExecuteNonQuery()
CodeProject
Download a free trial of the Wave Financial Data Provider to get started:
Download NowLearn more:
👁 Wave Financial IconRapidly create and deploy powerful .NET applications that integrate with Wave Financial.