Class ScaleItem

ScaleItem

問題項目,可讓作答者從一系列圓形按鈕序列中選擇一個選項。您可以透過 Form 存取或建立項目。但在測驗中使用時,系統會為這些項目評分。

// Open a form by ID and add a new scale item.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var item = form.addScaleItem();
item.setTitle('Pick a number between 1 and 10')
    .setBounds(1, 10);

方法

方法傳回類型簡短說明
createResponse(response)ItemResponse為這個體重計項目建立新的 ItemResponse
duplicate()ScaleItem建立這個項目的副本,並附加到表單末尾。
getGeneralFeedback()QuizFeedback傳回作答者在回答可評分的問題時會看到的意見回饋。
getHelpText()String取得項目的說明文字 (有時稱為 ImageItemsPageBreakItemsSectionHeaderItems 等版面配置項目的說明文字)。
getId()Integer取得項目的專屬 ID。
getIndex()Integer取得表單中所有項目的索引。
getLeftLabel()String取得體重計下限的標籤 (如果有的話)。
getLowerBound()Integer取得體重計的下限。
getPoints()Integer傳回可評分項目的分數值。
getRightLabel()String取得體重計上限標籤 (如果有的話)。
getTitle()String取得項目的標題 (在 SectionHeaderItem 中則稱為標題文字)。
getType()ItemType取得項目的類型,以 ItemType 表示。
getUpperBound()Integer取得體重計的上限。
isRequired()Boolean決定作答者是否必須回答問題。
setBounds(lower, upper)ScaleItem設定體重計的下限和上限。
setGeneralFeedback(feedback)ScaleItem設定在作答者回覆的可評分問題沒有正確或不正確答案 (也就是需要手動評分的問題) 時,向作答者顯示意見回饋。
setHelpText(text)ScaleItem設定項目的說明文字 (有時稱為 ImageItemsPageBreakItemsSectionHeaderItems 等版面配置項目的說明文字)。
setLabels(lower, upper)ScaleItem設定體重計的下限和上限標籤。
setPoints(points)ScaleItem設定可評分項目的價值分數。
setRequired(enabled)ScaleItem設定作答者是否必須回答問題。
setTitle(title)ScaleItem設定項目的標題 (在 SectionHeaderItem 中也稱為標題文字)。

內容詳盡的說明文件

createResponse(response)

為這個體重計項目建立新的 ItemResponse。如果 response 引數超出該項目設定的邊界,就會擲回例外狀況。

參數

名稱類型說明
responseInteger此體重計物品的值答案

回攻員

ItemResponse:項目回應

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

duplicate()

建立這個項目的副本,並附加到表單末尾。

回攻員

ScaleItem — 此 ScaleItem 的重複項目,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getGeneralFeedback()

傳回作答者在回答可評分的問題時會看到的意見回饋。

回攻員

QuizFeedback:意見回饋 (如果有的話)。

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getHelpText()

取得項目的說明文字 (有時稱為 ImageItemsPageBreakItemsSectionHeaderItems 等版面配置項目的說明文字)。

回攻員

String:商品的說明文字或說明文字

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getId()

取得項目的專屬 ID。

回攻員

Integer:項目的 ID

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getIndex()

取得表單中所有項目的索引。

回攻員

Integer:項目的索引

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getLeftLabel()

取得體重計下限的標籤 (如果有的話)。

回攻員

String:體重計下限的標籤

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getLowerBound()

取得體重計的下限。

回攻員

Integer:體重計的下限

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getPoints()

傳回可評分項目的分數值。

回攻員

Integer:問題可獲得的分數。

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getRightLabel()

取得體重計上限標籤 (如果有的話)。

回攻員

String:體重計上限標籤

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getTitle()

取得項目的標題 (在 SectionHeaderItem 中則稱為標題文字)。

回攻員

String:項目的標題或標題文字

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getType()

取得項目的類型,以 ItemType 表示。

回攻員

ItemType:項目的類型

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getUpperBound()

取得體重計的上限。

回攻員

Integer:體重計的上限

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isRequired()

決定作答者是否必須回答問題。

回攻員

Boolean:作答者是否須回答問題

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setBounds(lower, upper)

設定體重計的下限和上限。下限必須為 01。上限必須介於 310 之間 (含頭尾)。新的縮放比例預設為 1 的下限和 5 的上限。

如果指定的值超出允許限制,就會擲回指令碼例外狀況。小數會截斷至前一個整數。

參數

名稱類型說明
lowerInteger新的下限
upperInteger新的上限

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

擲回

Error — 如果下限或上限無效

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setGeneralFeedback(feedback)

設定在作答者回覆的可評分問題沒有正確或不正確答案 (也就是需要手動評分的問題) 時,向作答者顯示意見回饋。

參數

名稱類型說明
feedbackQuizFeedback新的意見回饋

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setHelpText(text)

設定項目的說明文字 (有時稱為 ImageItemsPageBreakItemsSectionHeaderItems 等版面配置項目的說明文字)。

參數

名稱類型說明
textString新的說明文字

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setLabels(lower, upper)

設定體重計的下限和上限標籤。

參數

名稱類型說明
lowerString就會使用
upperStringthe new label for the upper bound

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setPoints(points)

設定可評分項目的價值分數。新項目的預設值是 0。

參數

名稱類型說明
pointsInteger問題項目的價值分數

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setRequired(enabled)

設定作答者是否必須回答問題。

參數

名稱類型說明
enabledBoolean作答者是否必須回答

回攻員

ScaleItem:目前的項目 (用於鏈結)

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setTitle(title)

設定項目的標題 (在 SectionHeaderItem 中也稱為標題文字)。

參數

名稱類型說明
titleString新的標題或標題文字

回攻員

ScaleItem — 此 ScaleItem,用於鏈結

授權

使用這個方法的指令碼必須取得以下一或多個範圍的授權:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms