SiCranmer
|
Posted: 01/27/2002, 10:53 PM |
|
After reading Johns problem with this issue
(see http://www.gotocode.com/disc_viewt.asp?mid=1843&s_topic=Use+SQL+string& )
Please can you tell me the correct way to select data from multiple tables.
Cheers
Si.
|
|
|
Nicole
|
Posted: 01/28/2002, 5:09 AM |
|
Hello,
never mind both Grid and Record form have SQL tabs in their properties you may use custom sql for Grid form only (refer to CC built in help to find how to use custom sql queries. But the main idea is: you can use any custom sql that works in db query analyzer)
Custom sql isn't allowed on record type form. if you enter in it'd be ignored. The reason was explained by CC support: "because custom SQL may select more than one record and Record form doesn't have prev/next functionality"
|
|
|
SiCranmer
|
Posted: 01/28/2002, 9:39 AM |
|
Thanks I understand that, but I still want to know if I can enter an sql stmnt in say an event and pass the selected data (from related files connected by LEFT JOINs in the sql stmnt) into fields or if I have to change the generated code after its built.
Also, getting a bit adventurous, can you dynamically change a field type?
i.e.
I have a field that is set-up as a text box the first time the form is called (in INSERT mode), but I would then like it to be a label if the form is in UPDATED mode.
|
|
|
Nicole
|
Posted: 01/29/2002, 12:04 AM |
|
1. only one record from one table could be viewed and updated on CC record form. Otherwise you should totally redefine page action in CustomAction event.
2. check the form mode and depending on it use Label or TextBox field. To do it set field type to Label on the form and select 'HTML' checkbox in its properties. In BeforeShow event add custom code to display field as label or textbox.
PHP:
if $pPKprimary_key_field == ""
$fldfield_name = "<input type=\"text\" name=\"field_name\" maxlength=\"50\" value=\"\" size=\"50\">";
And create CustomAction event in order to modify insert sql query and include field_name field to it.
|
|
|
Nicole
|
Posted: 01/29/2002, 2:35 AM |
|
sorry, I have a misprint, the correct code is:
if ($pPKprimary_key_field == "")
$fldfield_name = "<input type=\"text\" name=\"field_name\" maxlength=\"50\" value=\"\" size=\"50\">";
|
|
|