Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, November 30, 2024 
 
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!
 Architect Forums - Controls
Forum to discuss usage & tips for SalesLogix controls and other 3rd party ActiveX controls. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Controls | New ThreadView:  Search:  
 Author  Thread: dynamic picklist items ..?
RJ Eaton
Posts: 234
 
dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 7:27 AM
I am in the process of modifying the Activity Detail screen.

Our business would like the ability to show specific products that maybe reviewed in the meeting. I have a product table that is updated from our data warehouse multiple times during the day so I am taking from my product table the Family field and using that as one picklist... A second picklist is filled based on the selection of the first SO if user picks Family A they get all products in Family A for selection in second picklist..

No issues so far.. Trouble arises when I try to clear the picklist on the change of selection, as your probably aware of there is no Application.Picklists("picklistName").Item.Delete --> **note to all Sage people watching,

Ok so people have told me to use combo box but then I lose the multiselect capability they want.. Ok try Listbox... Sure, one family has > 100 products and it is only listing the first 100..?? BTW what is the syntax to get the actual text from the itemindex from a listbox..?

I am to the point where I am considering using datagrids to select info and them create a box for ones selected for this meeting.

Anyone have an idea as to what they might do for this... Reaching the part where I'm scratching my head and there is not much left up there
[Reply][Quote]
Vladimir
Posts: 93
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 8:10 AM
I did like this...
First picklist (pklFamily) consist of Family Name items:
Family A
Family B
Family C

For second picklist (pklProduct) I created 3 picklists:
Product Family A
Product Family B
Product Family C

On the event OnChange of fist picklist I set script:
pklProduct.PicklistName.Name = "Product " & pklFamily.Text
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 9:58 AM
Vlad, Thanks for the idea but you missing the point...

I need to not change the actual picklist but to change the items wihtin the lists... So Picklist 1 is dynamic created from the Faily field in products.. Picklist 2 is a listing of all the products based on the family in picklist one.. I have the sql to grab the items and can add them to the picklist on the fly.. the issue is that I can't remove the items once they are in the picklist..

Possible to run a delete statement deleting all the items from picklistid X..? except this might have to be hard coded.. nightmare for next developer..see my issue now..?

Thanks for the help
[Reply][Quote]
Jason Buss
Posts: 382
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 12:13 PM
Just a thought...

I suppose you could delete the items from the picklist table directly. If you're not clear on how those are stored, you can return the itemID of the record pertaining to the appropreate item to delete with this statement (using the 'Account Status' picklist and the 'Inactive' picklist item):

select itemid from picklist where text = 'Inactive' and picklistid in (select itemid from picklist where text = 'Account Status')

or delete the specific item directly with:

delete from picklist where text = 'Inactive' and picklistid in (select itemid from picklist where text = 'Account Status')

Or otherwise to delete everything in a list:

delete from picklist where picklistid in (select itemid from picklist where text = 'Account Status')

I've never tested this in the SLX environment, and I'm not sure the dataprovider will handle the 'IN' clause with a delete statement, so you might have to play with it a little.

[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 12:33 PM
Jason, Your ideas make sense... I can get the picklistid from the Application.Picklists("picklistName").Id for the picklist I need..

And I can delete the items from the table, however they still show in the actual picklist control. I have tried refreshes of the view and form and neither helps..


I was using a delete from picklist where picklistid = 'ID I got from above" -- this would really be easy if there was a picklist.Item.delete sigh
[Reply][Quote]
Jason Buss
Posts: 382
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 1:53 PM
Well, I tested this out and was able to see that the list item was removed by doing a full refresh (ctrl-F5 vs just F5), but that's kind of a pain to have to wait for that refresh to finish...
[Reply][Quote]
Jason Buss
Posts: 382
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 2:10 PM
I found somthing that looks somwhat promising... If you keep drilling down into the application object, you get to: Application.PickLists.Item.Item(bySequence, byShortText, ByText).Delete

I have no idea what parameters need to be passed to the object at what points, but the presence of the "delete" at least implies that you should be able to delete an item.
[Reply][Quote]
Jason Buss
Posts: 382
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 2:41 PM
Ok, I tried somthing that *almost* worked. It appears as though there IS actually a delete method, although it doesn't quite seem to work the way I would think.

Using this code, I would think it would cycle through the items in the picklist, and delete each item:

Dim List
Dim i,

Set List = Application.PickLists("aaaTestList1")
For i = 0 to List.Count - 1
list.Item(i).Delete
Next
Set List = Nothing


What actually happens is that it deletes every other item in the list, and throws an error. For example if you have 4 items in the list (Item1, Item2, Item3, Item4), and you run this code, you end up with Item2 and Item4 remaining with an "object Required" error. If you run it again, you are left with Item4 and the error message again. Run the code a third time and the last item is removed, and no error is presented.

I realize this probably generates more questions than answers, but I think this is at least on the right track.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 07 5:58 PM
Quote:
Originally posted by Jason Buss

What actually happens is that it deletes every other item in the list, and throws an error.


The reason why it does this is that when you delete the item at index 0, everything shifts down one, so what was at index 1 before, is now at index 0. Now when you delete the item at index 1, you're really deleting what was originally at index 2. Does that make sense?

What you will want to do is *always* delete the item at index 0. Like this:

Dim List
Dim i,

Set List = Application.PickLists("aaaTestList1")
For i = 0 to List.Count - 1
list.Item(0).Delete
Next
Set List = Nothing


Does that make sense?

-Ryan
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Nov 07 8:17 AM
Thanks Jason and Ryan, code seems to work perfectly now.. Another undocumented feature in SLX.. the picklist.Item().delete,

Is there a way to see maybe by pulling the controls or a SLX instance into VS to see if there are other undocumented features like this one..?

Thanks again
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Nov 07 9:32 AM
I believe .Delete will remove the item but aren't the picklist items cached in an object? I believe specific versions of SLX wouldn't remove both the SQL and object. You had to refresh SLX to get all of the changes. That may not be true for 7.2 but I believe it probably affects earlier versions > 6.0 and < 7.2. Then again I could be totally wrong and hopefully so. My idea for an in-client PickList Manager used by someone other than ADMIN may finally come to fruition.
[Reply][Quote]
Jason Buss
Posts: 382
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Nov 07 3:08 PM
Aw, Jeez... I think I'll bang my head into my desk for a while...

Thanks Ryan!
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Nov 07 9:35 AM
Hey Jeremy! Long time no see. Where have you been? (Good to see you back)

-Ryan
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Nov 07 9:36 AM
Quote:
Originally posted by Jason Buss

Aw, Jeez... I think I'll bang my head into my desk for a while...


That's an easy one to miss. I've had a few bruises on my head from that same sort of thing before too
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Nov 07 9:38 AM
Quote:
Originally posted by RJ Eaton

Is there a way to see maybe by pulling the controls or a SLX instance into VS to see if there are other undocumented features like this one..?


I actually do look at the SlxControls.ocx in the object browser in VS quite often to see everything there. I couldn't imagine working with SLX controls without it!
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Nov 07 9:28 AM
Undocumented or not.....we don't mess around with the PickList Collection at round time.....leave that to the SLX interface.....

to do what you are doing we simply use a Combo box.......
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: dynamic picklist items ..?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Nov 07 11:44 AM
RJ, ComboBox didn't meet requirements.. needed to be on the activities detail form, needed to have multiselect, some groups form the first picklist only have 2-3 items while others might have 190..

I have managed to get it working correctly based on the discussion here. There is a very clunky feature however, in order to ensure the picklists are cleaned next pass on the close of the activities detail form a full refresh is needed. This makes it a bit slow compared to your suggestion but the business is happy with it and what else can I do..
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/30/2024 10:45:08 AM