05-16-2012 03:47 AM
I am new to SData.
What I am ultimately trying to do is search the database for a business and if it doesnt exist then insert the business into the database.
I have the example below working that searches for contacts with a last name starting with a but I would also like to search on company name, town, website and telephone. Please can someone tell me how I would do this.
Any help would be grately appreciated.
Dim svc As ISDataService = New SDataService("http://IP:PORT/sdata/slx/dynamic/-/", "USERNAME", "PASSWORD") Dim req As SDataResourceCollectionRequest = New SDataResourceCollectionRequest(svc) req.ResourceKind = "Contacts" req.QueryValues.Add("where", "LastName like 'a%'") Dim feed As AtomFeed = req.Read() For Each entry As AtomEntry In feed.Entries Dim payload As SDataPayload = entry.GetSDataPayload() Dim account As String = payload.Values("AccountName").ToString Dim contactName As String = payload.Values("NameLF").ToString TextBox1.Text += account & ", " & contactName & vbCrLf Next
05-17-2012 04:02 PM - edited 05-17-2012 04:04 PM
Here are some starters:
http://yourserver/sdata/slx/dynamic/-/accounts?format=json&where=AccountName like 'A%'&orderby=CreateDate desc
http://yourserver/sdata/slx/dynamic/-/accounts?format=json&where=Address.City like 'A%'&orderby=CreateDate desc
http://yourserver/sdata/slx/dynamic/-/accounts?format=json&where=Address.State eq 'TX'&orderby=CreateDate desc