在此處,我們要建立查詢 Enumerations 輸入計算欄位。 此欄位將在資料預覽視窗中產生額外的欄。 此欄會指定每個收件者(0、1和2)作為結果所傳回的數值。 會為新欄中的每個值指派性別:「男性」代表「1」,「女性」代表「2」,如果值等於「0」,「未指示」。
需要選取哪個表格?
收件者表格(nms:recipient)
要在輸出欄中選取的欄位?
姓氏、名字、性別
要根據哪些條件篩選資訊?
收件者語言
應用以下步驟:
開啟一般查詢編輯器並選取收件者表格(nms:recipient)。
在 Data to extract 視窗,選取 Last name, First name 和 Gender.
在 Sorting 視窗,按一下 Next:此範例不需要排序。
在 Data filtering 中選取 Filtering conditions。
在 Target element 視窗,設定篩選條件以收集講英語的收件者。
在 Data formatting 視窗,按一下 Add a calculated field.
前往 Type 視窗 Export calculated field definition 視窗並選取 Enumerations.
定義新計算欄位必須參考的欄。 若要這麼做,請選取 Gender 欄(位於的下拉式功能表中) Source column 欄位:目的地值將與 Gender 欄。
定義 來源 和 目的地 值:目的地值可讓查詢結果更易於讀取。 此查詢應傳回收件者性別,結果將為0、1或2。
對於要輸入的每個「source-destination」行,按一下 Add 在 List of enumeration values:
選取 Keep the source value 函式。
按一下 OK 以核准計算欄位。
在 Data formatting 視窗,按一下 Next.
在預覽視窗中, start the preview of the data.
額外的欄會定義0、1和2的性別:
例如,如果您未在 List of enumeration values,以及 Generate a warning and continue 的功能 In other cases 欄位中選取時,您會看到警告記錄。 此記錄指出尚未輸入性別「2」(女性)。 它會顯示在 Logs generated during export 資料預覽視窗的欄位。
再舉一個例子,說明列舉值「2」並未輸入。 選取 Generate an error and reject the line 函式:所有性別「2」收件者都會提出異常和行中的其他資訊(名字和姓氏等) 將不會匯出。 錯誤記錄會顯示在 Logs generated during export 資料預覽視窗的欄位。 此記錄指出未輸入列舉值「2」。