6/30/2025 9:29:00 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
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 the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Refreshing a lookup Control with a variable value
Posted: 29 Apr 10 10:02 AM
|
Hi All,
I am really new to Sales Logix and I am using a Code snippet Action Item on an OnChange Event of a PickList Control and using VB and not C#.All I am trying to do is when a picklist item is changed ,I am executing a Stored Procedure (SQL Server) ans getting the Output parameter and providing that to the lookup control in the same from.But the lookup control is not being refreshed.I tried inserting a text control which is not bound to any entity and provided the same value to this text box and that is working fine.But my objective is to display the new value in the lookup.Aslo I am trying to disable the lookup control based on the value selected in the Pickup list and even this is not working for me.I dont know what I am doing wrong.I am pasting the Code that I am currently using.Any help is greatly appreciated.Thanks.
Dim connStr As String connStr = ("Provider=SQLOLEDB.1;Data Source=server-sl-dev;Integrated Security=SSPI;Initial Catalog=saleslogixdev") Dim conn As System.Data.OleDb.OleDbConnection Dim comm As System.Data.OleDb.OleDbCommand conn = New System.Data.OleDb.OleDbConnection(connStr)
conn.Open() comm = New System.Data.OleDb.OleDbCommand()
comm.Connection = conn comm.CommandType = System.Data.CommandType.StoredProcedure comm.CommandText = "[sysdba].[SCNGetFragranceCatalogMasterNumber]"
comm.Parameters.Add("@fragtype", System.Data.OleDb.OleDbType.VarChar, 64).Value = form.FragranceType.PickListValue comm.Parameters.Add("@masternumber", System.Data.OleDb.OleDbType.VarChar, 64).Direction = System.Data.ParameterDirection.Output
comm.ExecuteNonQuery()
'form.MasterNumber.Text=comm.Parameters("@masternumber").Value 'form.MasterNumber.LookupResultValue = comm.Parameters("@masternumber").Value 'form.MasterNumber.AutoPostBack = True form.Test.Text = comm.Parameters("@masternumber").Value Dim str As String str = form.Test.Text
form.MasterNumber.LookupResultValue = str comm.Dispose() conn.Close() If form.FragranceType.PickListValue = "Existing Master Number" Then form.MasterNumber.Enabled= True Else form.MasterNumber.Enabled= False End If |
|
|
|
Re: Refreshing a lookup Control with a variable value
Posted: 11 May 10 5:28 AM
|
Hi,
1) Is the stored procedure code returning a value (have you verified this)?
2) Is the lookup object or string bound, or unbound?
3) Setting a form textbox value and then picking up the value from the texbox is odd - you should just use the value directly i.e.:
form.Test.Text = comm.Parameters("@masternumber").Value Dim str As String str = form.Test.Text
should be changed to:
Dim str as String str = comm.Parameters("@masternumber").Value form.Test.Text = str
4) Is the picklist bound? If so get the value off the entity, not the form. (Bad practice).
i.e (sorry, hybrid C#/VB here..., and assuming its an account form) Sage.Entity.Interfaces.IAccount acc = (Sage.Entity.Interfaces.IAccount)this.BindingSource.Current; string fragranceType = acc.FRAGRANCETYPE (whatever the property name is).
if fragranceType = "Existing Master Number" Then
do you stuff.....
If none of the fields are bound you can get some very funny behaviour with regard to the values you are expecting to see in the controls, which might explain your problems.
Thanks, Nick |
|
|
|
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!
|
|
|
|
|
|
|
|