Java
以下は、Android 向け Zoho Creator SDK の各種メソッドの使用方法を示すコードスニペットです:
Creator アプリ内に存在するセクションを取得する
次のスニペットでは、Zylker_Orders が対象の Creator アプリケーションのリンク名です:
- try {
- // ここにコードを記述します
- ZCApplication firstApp = appList。取得する(0);
- List<ZCSection> sections =
- ZOHOCreatorUtil。getApplicationDetails(firstApp);
- } catch (ZCException e) {
- e。printStackTrace();
- // エラー処理を行う
- }
次のスニペットでは、注文 が対象フォームのリンク名です:
- try {
- ... // ここにコードを記述します
- ZCSection firstSection = sections。取得する(0);
- ZCComponent firstComponent =
- firstSection。getComponents().取得する(0);
- if(firstComponent。getType().equals(ZCComponentType。FORM)){
- ZCForm form = FormUtil。getForm(firstComponent);
- }
- } catch (ZCException e) {
- e。printStackTrace();
- // エラー処理を行う
- }
次のスニペットでは、All_Orders が対象レポートのレポート名です:
- try {
- ... // ここにコードを記述します
- ZCSection firstSection = sections。取得する(0);
- ZCComponent firstComponent =
- firstSection。getComponents().取得する(0);
- if(firstComponent。getType().equals(ZCComponentType。レポート)){
- ZCReport レポート = ReportUtil。getReport(firstComponent);
- }
- } catch (ZCException e) {
- e。printStackTrace();
- // エラー処理を行う
- } catch (CloneNotSupportedException e) {
- e。printStackTrace();
- }
Kotlin
Creator アプリ内に存在するセクションを取得する
次のスニペットでは、Zylker_Orders が対象の Creator アプリケーションのリンク名です:
- try {
- ... // ここにコードを記述します
- val firstApp: ZCApplication = appList。取得する(0)
- val sections: List = ZOHOCreatorUtil。getApplicationDetails(firstApp)
- } catch (e: ZCException) {
- e。printStackTrace()
- // エラー処理を行う
- }
次のスニペットでは、注文 が対象フォームのリンク名です:
- try {
- ... // ここにコードを記述します
- val firstSection: ZCSection = sections。取得する(0)
- val firstComponent = firstSection.components。取得する(0)
- if (firstComponent。種類 == ZCComponentType。FORM) {
- val form: ZCForm = FormUtil。getForm(firstComponent)
- }
- } catch (e: ZCException) {
- e。printStackTrace()
- // エラー処理を行う
- }
次のスニペットでは、All_Orders が対象レポートのレポート名です:
- try {
- ... // ここにコードを記述します
- val firstSection: ZCSection = sections。取得する(0)
- val firstComponent = firstSection.components[0]
- if (firstComponent。種類 == ZCComponentType。レポート) {
- val レポート = ReportUtil。getReport(firstComponent, 50)
- }
- } catch (e: ZCException) {
- e。printStackTrace()
- // エラー処理を行う
- } catch (e: CloneNotSupportedException) {
- e。printStackTrace()
- }