The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Help in Insert 
Posted: 17 Dec 07 12:56 AM
|
The string objSLXDB.execute strsql does not work
Dim strSQL Dim objSLXDB Set objSLXDB = Application.GetNewConnection
strSQL = "INSERT INTO C_FAMILY " &_ " (C_FAMILYID " &_ " ,ACCOUNTID " & _ " ,FIRSTNAME " & _ " ,LASTNAME" & _ " ,MIDDLENAME " & _ " ,BIRTHDATE " & _ " ,RELATIONSHIP " & _ " VALUES " & _ " ('"&Application.BasicFunctions.GetIDFor("C_FamilyID") &"','" & txtAccountID.Text & "','"& txtFirstName.Text & "','" & txtLastName.Text & "','" & txtMiddleName.Text & "','" & DateTimePicker1.Date & "','" & PickList1.Text &"') " objSLXDB.execute strSQL
strSQL = "INSERT INTO ADDRESS " & _ " (ADDRESSID " & _ " ,DESCRIPTION " & _ " ,ADDRESS1 " & _ " ,ADDRESS2 " & _ " ,ADDRESS3 " & _ " ,CITY " & _ " ,STATE " & _ " ,POSTALCODE " & _ " VALUES " & _ " ('" &Application.BasicFunctions.GetIDFor("ADDRESSID") & "','" & pkldescription.Text & "','" & txtadd.Text & "','" & txtadd2.Text & "','" & txtadd3.Text & "','" & pklCity.Text & "','" & pklstate.Text & "','" & txtzip.Text & "','" & pklCountry.Text &"') "
objSLXDB.execute strSQL |
|
|
|
Re: Help in Insert 
Posted: 17 Dec 07 1:48 AM
|
don't bother to answer already found the problem. |
|
|
|
Re: Help in Insert 
Posted: 17 Dec 07 9:24 AM
|
Hi Anjo,
Would you mind posting the solution you find? - as it will help others who face the same problem. Thanks in advance.
Muni |
|
|
|
Re: Help in Insert 
Posted: 18 Dec 07 7:48 AM
|
Both SQL statements are missing the ) after the field names, and before the "Values" section. Also, I believe you will need to add the EntityId to the Address table. |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 2:53 AM
|
here is the answer
strSQL = "INSERT INTO C_FAMILY " &_ " (C_FAMILYID " &_ " ,ACCOUNTID " & _ " ,FIRSTNAME " & _ " ,LASTNAME" & _ " ,MIDDLENAME " & _ " ,BIRTHDATE " & _ " ,RELATIONSHIP ) " & _ " VALUES " & _ " ('"&Application.BasicFunctions.GetIDFor("C_FamilyID") &"','" & txtAccountID.Text & "','"& txtFirstName.Text & "','" & txtLastName.Text & "','" & txtMiddleName.Text & "','" & DateTimePicker1.Date & "','" & PickList1.Text &"') " 'msgbox strsql objSLXDB.execute strSQL
strSQL = "INSERT INTO ADDRESS " & _ " (ADDRESSID " & _ " ,DESCRIPTION " & _ " ,ADDRESS1 " & _ " ,ADDRESS2 " & _ " ,ADDRESS3 " & _ " ,CITY " & _ " ,STATE " & _ " ,POSTALCODE " & _ " ,COUNTRY " & _ " ,ENTITYID )" & _ " VALUES " & _ " ('" & Application.BasicFunctions.GetIDFor("ADDRESSID") & "','" & pkldescription.Text & "','" & txtadd.Text & "','" & txtadd2.Text & "','" & txtadd3.Text & "','" & pklCity.Text & "','" & pklstate.Text & "','" & txtzip.Text & "','" & pklCountry.Text &"', 0 ) "
' msgbox strsql objSLXDB.execute strSQL |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 5:22 AM
|
Should the Address.Entityid value be set to the Account.AccountID? |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 9:39 AM
|
No, as it won't be tying back to the account - but I guess it would work if it had the C_FamilyID in it. |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 9:46 AM
|
In order to utilize the address information it would see that either the c_family record needs to have an addressid reference, the entityid needs to be set, or both. |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 9:59 AM
|
Very true - it wouldn't be necessary, but as with accounts and contacts, Monkey See Monkey Do, right?
I just figured it would be best to follow the example. |
|
|
|
Re: Help in Insert 
Posted: 19 Dec 07 10:41 AM
|
The 2nd sample SQL set the entiryid to 0. Which may not make much sense. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|