Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to come up with a view/CA model
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01410693
Message ID:
01410719
Views:
33
>>>>>>No, only if I already have records for such models in my table.
>>>>>
>>>>>Sure.
>>>>>
>>>>>I know understand what you want(I think so)
>>>>>Correct me if I'm wrong. You want to get ALL the selected models and IF some of them missing in That table to add them before the result is shown to user?
>>>>
>>>>Yes, exactly. And also somehow have a way to select models without a need for 100 parameters (have it dynamic).
>>>
>>>You have Models table isn't it?
>>
>>Yes.
>>
>>I've created a form with a textbox at the top to select an Option.
>>
>>Bellow is a first mover to select makes.
>>
>>Bellow is the second mover to select models (based on selected makes).
>>
>>So, the second mover destination will have several models selected.
>>
>>Now, bellow I need to show a grid with selected information and allow a user to enter price information.
>>
>>That's the brief idea.
>
>
>
>*** SelectCmd
>SELECT ISNULL(YourTable.OptionID,?m.selOptionID) AS OptionID,
>       ISNULL(YourTable.MakeId  ,?m.selMakeID)  AS lMakeID,
>       ISNULL(YourTable.ModelId  ,Models.Id)    AS ModelId,
>            rest of the fields
>FROM YourTable
>FULL JOIN Models ON YourTable.ModelId = Models.Id AND CHARINDEX([_]+CAST(Models.Id as varchar(20))+[_] , ?m.lcModels) > 0
>WHERE YourTable.OptionID = ?m.selOptionID AND
>             YourTable.MakeId   = ?m.selMakeID   AND
>            CHARINDEX([_]+CAST(YourTable.ModelId as varchar(20))+[_], ?m.lcModels) > 0
>
>m.selOptionID = 1
>m.selMakeID  = 12
>lcModels       = "_1_7_12_225_"
>
SELECT ISNULL(YourTable.OptionID,?m.selOptionID) AS OptionID,
>       ISNULL(YourTable.MakeId  ,?m.selMakeID)  AS lMakeID,
>       ISNULL(YourTable.ModelId  ,Models.Id)    AS ModelId,
>            rest of the fields
>FROM Models LEFT JOIN myTable on Models.ID = myTable.ID and myTable.MakeID = ?lnMakeID
 where cast(Models.ModelID as varchar(20)) $ ?lcModels
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform