API Questions on Kentico API.
Version 5.x > API > Macros in SQL for Multiple Choice Type Fields View modes: 
User avatar
Member
Member
Nesfuratu - 7/20/2011 12:41:16 AM
   
Macros in SQL for Multiple Choice Type Fields
Hi,

I have a doc type of Product. And in the doc type, I have a field of type “Multiple choice” called Technologies which I’m using a SQL query to populate the options.

SELECT ItemID, TechnologyDescription FROM CUS_Technology

As you can see Technology is a custom table. The problem I have is that CUS_Technology contains over 100 records. And that could be very ugly to load up 100 check boxes when editing the product. Part of the CUS_Technology table, is a field called Brand. This corresponds to a Brand that is also available in the product table.

My question is, is way that I can change the select above to look like

SELECT ItemID, TechnologyDescription FROM CUS_Technology
WHERE CUS_Technology.Brand = Product.Brand?

Thanks,

User avatar
Member
Member
kentico_michal - 7/21/2011 5:18:07 AM
   
RE:Macros in SQL for Multiple Choice Type Fields
Hello,

Regrettably, it is not possible to specify such a SQL query. I would recommend to create a custom form control for Technologies field as it is described in documentation: Form controls.

This custom form control could contain Check-box list that would be filled with SQL query depending on the selected value from the Brand field that you can get as follows:

TextBox txtBox = (TextBox) Form.FieldControls["productprice"];


Best regards,
Michal Legen