From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 72: | Line 72: | ||
'''end;''' | '''end;''' | ||
<br> | <br> | ||
<pre style="background-color:#E14D2A; color:white"> Try making your SQL query data suitable for your project. Otherwise you will get an error. </pre><br> | |||
'''Example:'''<br> | '''Example:'''<br> | ||
Revision as of 07:32, 10 February 2023
It is a definition that you can use when you want to create a special page in your project. We can create and format our custom page with the help of data defined with the OpenFormParams class. Below are the parameters of this class.
TOpenFormParams = class
- OpenFormTemplate :TFormTemplate;
- OpenDisplayType :TFormDisplayType;
- OpenListObject : TFormListObject;
- RecordOption :TFormRecordOption;
- FilterOption :TFormFilterOption;
- QueryFilter :String;
- CustomDataSource :TClJSonQuery;
- CustomDataProcedureName :String;
- CustomFormName :String;
- CustomFormDisplayName,
- CustomFormGUIDFieldName,
- CustomFormNameFieldName,
- CustomFormCodeFieldName,
- CustomBackFormGUIDFiledValue,
- CustomBackFormSelectedFilter,
- CustomFormReferenceFieldName,
- CustomParamID :String;
- CustomBackFormValuesOverWrite :Boolean;
- OwnerForm :TForm;
Explanation:
| Parameter | Explanation |
|---|---|
| DBCloudQueryWith | We need to enter data to query. Fetch the data from the Example Product. It can be used by entering one of the data in the Form Templates page. |
| CustomDataSource | It is the process of transferring our data source. |
| OpenFormTemplate | It is defined to create our custom form template. Here we open an empty custom form page by saying "ftBaseCustoms". We insert the data into it with the "DBCloudQueryWith" parameter. |
| CustomParamID | It has been defined so that options can be used on different screens or for different users. |
| CustomFormDisplayName | The display name field to be given to the Custom Form. |
| CustomFormGUIDFieldName | The GUID data of the component defined in the "DBCloudQueryWith" parameter is retrieved. |
| CustomFormCodeFieldName | The code of the component defined in the "DBCloudQueryWith" parameter is retrieved. |
| CustomFormNameFieldName | The name of the component defined in the "DBCloudQueryWith" parameter is retrieved. |
| CustomFormName | The name field to be given to the Custom Form. |
| OpenDisplayType | It can be used by entering one of the data in the Form Display Types page. |
| RecordOption | It can be used by entering one of the data in the Form Record Options page. |
| FilterOption | It can be used by entering one of the data in the Form Filter Options page. |
| RunOpenForm | It was created to enable the execution of the created custom form. |
Let's now see how to do this.
Example:
With this example, we are bringing data from Clomosy components (Products, Customers, Items, etc.) to our custom form.
var CloudQ:TClJSONQuery;
begin
CloudQ := Clomosy.DBCloudQueryWith(ftProducts,'','1=1'); Clomosy.OpenFormParams.CustomDataSource := CloudQ;
Clomosy.OpenFormParams.OpenFormTemplate := ftBaseCustoms; Clomosy.OpenFormParams.CustomParamID := '1' ; Clomosy.OpenFormParams.CustomFormDisplayName := 'My Custom Form'; Clomosy.OpenFormParams.CustomFormGUIDFieldName := 'Product_GUID'; Clomosy.OpenFormParams.CustomFormCodeFieldName := 'Product_Code'; Clomosy.OpenFormParams.CustomFormNameFieldName := 'Product_Name'; Clomosy.OpenFormParams.CustomFormName :='FrmMyCustomForm';
Clomosy.OpenFormParams.OpenDisplayType := fdtsingle; Clomosy.OpenFormParams.RecordOption := froReadOnly; Clomosy.OpenFormParams.FilterOption := ffoNoFilter; Clomosy.RunOpenForm(Clomosy.OpenFormParams);
end;
Try making your SQL query data suitable for your project. Otherwise you will get an error.
Example:
Since our data is kept in the cloud system when we perform registration or other operations in our project, we can receive this data by saying "DBCloudSQLSelectWith" and show it in a special form. The example is for this.
Var CloudQ:TClJSONQuery; sqlString:String;
begin
sqlString:=' SELECT P.Product_Name AS MAINVIEW_TEXT ,'+ QuotedStr('Member: ') +'+ Customer_Name AS MAINVIEW_SUBTEXT, P.Product_Name,Customer_Name FROM tblProjectThreads AS T LEFT JOIN tblProjectProducts AS P ON T.Thread_Product_ID = P.Product_ID left join tblProjectCustomers AS C ON T.Thread_Customer_ID = C.Customer_ID GROUP BY P.Product_ID,P.Product_Name,T.Thread_Customer_ID,Customer_Name ';
Clomosy.OpenFormParams.CustomDataSource := Clomosy.DBCloudSQLSelectWith(sqlString); CloudQ := Clomosy.OpenFormParams.CustomDataSource;
Clomosy.OpenFormParams.OpenFormTemplate := ftBaseCustoms; Clomosy.OpenFormParams.CustomFormDisplayName := 'Records'; Clomosy.OpenFormParams.CustomFormGUIDFieldName := 'Customer_Name'; Clomosy.OpenFormParams.CustomFormNameFieldName := 'Product_Name'; Clomosy.OpenFormParams.CustomFormCodeFieldName := 'Product_Name'; Clomosy.OpenFormParams.CustomFormName :='FrmMyCustomMobilForm'; Clomosy.OpenFormParams.CustomParamID := '.1';
Clomosy.OpenFormParams.OpenDisplayType := fdtNone; Clomosy.OpenFormParams.RecordOption := froReadOnly; Clomosy.OpenFormParams.FilterOption := ffoNoFilter; Clomosy.RunOpenForm(Clomosy.OpenFormParams);
end;