Updating FileDropCombo value from code

I have a window with two FileDropCombo’s on parent and child file
The way it used to work is that when you select parent ( car make ) record, the child ( car models ) list gets filled with models for that car make eg you select Ford and you get choices like Escort, Fiesta, Probe etc.
Now the client wants to be able to skip selecting make and just entering the model eg. Fiesta and upon completion the make should be filled automatically in the other drop combo based on IdMake field in Models file. How can I get the Makes drop combo to display correct Make when user accepts new model?
The other problem is that if user selects Model and then changes Make the Models combo still displays previous value, resulting in eg. Toyota Fiesta. On the original procedure using range limits on the Model’s combo the value get’s reset when Make is updated, but on my hand coded range limit it does not work.

What I want to accomplish is : if Make is not selected all models are available in Models drop combo. If user selects Make the list of models is limited to that Make only (that works in my example). If user changes Make the value for Model is cleared, if user selects Model without choosing Make the Make is updated automatically based on file relationship.

My example code is here https://yait.blog/clarion/MarTest.zip

Any suggestions?

Thanks

Greg

I cant access:download non https links.
If the file drop combo is not imperative, you could have a separate browse/filedrop with the make and model as a combined view, then show the make file drop combo and the combined make model browse/filedrop.
If make filedrop combo assigns the make id, unhide/enable the model filedropcombo and disable/hide the make and model browse/filedrop.
Likewise if the make and model browse/filedrop is used, provided the make id is at least a hotfield you could assign that id to what ever the field is that stores the make id from the filedrop combo.

Edit: I’ve hit the max number of posts I can do on the 1st day so my reply to your post here Updating FileDropCombo value from code is below.

I’m thinking a browse with the make and model files combined into a view and then a filtered search anywhere locator. Then hide the file drop combos if they want to do a search anywhere or have the file drops on one tab and the browse showing all makes and models on another tab.

You see the user knows what they want and like you say, some will want to use the file drop because of past experience/knowledge thats its easier to select the make then drill down into the models, but for other lookups, the browse would be easier where they can just search by the model, so a sheet control with two tabs gives them that option to select the lookup method best suited for the vehicle they are searching for. It also means you dont need a button to clear and reset which ever lookup the user is doing because thats the other problem, what if they use the wrong lookup method, do they close the window and start again?

Sorry, the link is actually https, but for some reason “s” was cut off. Fixed the link now.

File drop combo is not imperative, however client is used to it. Currently they select the make first and then choose from available models, but they say it would be quicker if they could just type eg. Fiesta instead of typing Ford and then Fiesta. They add a couple of hundred records daily and also use similar window for searching the spare parts database.
Models table is currently 1500 rows, the example has just a few rows for testing purposes. For some end users it may be easier to select the make first and than have models filtered, but for others that work with specific models searching for eg. Fiesta may be quicker. I just don’t want to make a revolution for people that are used to working in a certain way, some of them use this software for more than 10 years.

Default for combos is to fill queues at the start of a procedure.

a) If a choice of Make is not made, the Model queue must include all records.
b) Once a Model choice is made, if make has not been entered, you need to reset Make with the parent value of the Model.
c) If a choice of Make IS made first, Model queue must be reset & filtered by the parent value from Make.

Yes, this is what happens when the window is opened. Both combo’s are populated with all records from both files

That is what I’m trying to do with this code


    CASE ACCEPTED()
    OF ?MOD:Model
      IF FDCB7.Q.MAK:Id <> FDCB6.Q.MOD:IdMakeFK THEN 
          IdMAK = FDCB6.Q.MOD:IdMakeFK
          FDCB7.Q.MAK:Id = FDCB6.Q.MOD:IdMakeFK
          FDCB7.TakeNewSelection(FIELD())
          FDCB7.ResetQueue()
      END    

but it does not set the MAK:Make field value

That’s what I’m doing with this code


    CASE ACCEPTED()
    OF ?MAK:Make
      IF IdMAK <> 0 THEN 
        FDCB6.AddSortOrder(MOD:byIdMakeFKModel)
        FDCB6.AppendOrder('MOD:Model')
        FDCB6.AddRange(MOD:IdMakeFK,IdMAK)
        FDCB6.ResetQueue(1)  
      END    

It resets Model combo filtering only models for selected make. However when I change the make after selecting model it does not clear MOD:Model field, so if we choose say Fiesta which should set the make to Ford and then change the make to Toyota, we end up with Toyota Fiesta instead of Toyota and blank model. The models dropdown is reset to Toyota models, but the MOD:Model still displays old value.

So the question is really what methods should I call to reset the values in a combo

I’d rather avoid creating more lookup windows or tabs, the actual window on a production system is far more complex than just selecting make and model. Besides, I use tps ISAM tables over the network so search anywhere would be slow with 1500 records to be filtered

Thats fair enough keeping the number of screen controls down, but if you had the IMDD, you could do the search anywhere locator on the IMDD file/table if the workstations had enough ram and wasnt just using the swap file, however ssd drives are fractionally slower than ram so TPS files on a SSD can be quite quick now, rather than a rusty spin disk.

1500 records isn’t very many. Seems like IMDD or In-Memory SQLite should be a good way to go.

Include the conditions as code for your combo filters, then simply call ResetQueue(True) when needed. No need to bother with order & range,
In pseudo code:
IF MakeID = 0
Model has no filter
ELSE
Model is filtered by MakeFK value
END

My apologies on forgetting about TPS files. In that case, you may want to specify key & range as appropriate. It is increasingly difficult for me to access the TPS brain memory files these days after converting to PG.