Map Table to Card Buttons

Maps the contents of a data table and generates buttons for previously obtained cards.

Command availability: IBM RPA SaaS and IBM RPA on premises

Dependencies

Use either the Map Table to Cards or Create Card command to generate the list of cards to insert in the Cards parameter.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

mapTableToCardButtons --dataTable(DataTable) --cardItems(List<CardItem>) --buttonActionColumn(String) --buttonTextColumn(String) --buttonValueColumn(String)

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Table dataTable Required Data Table Data table containing the Button Action, Button Text, and Button Action Value columns and their contents.
Cards cardItems Required List<Card Item> List of cards for which buttons should be created.
Button action column buttonActionColumn Required Text Name or position of the column that specifies the action the card button should perform.
Button text column buttonTextColumn Required Text Name or position of the column that specifies the card button text.
Button value column buttonValueColumn Required Text Name or position of the column that specifies the card button action values.

Example

This command maps a data table in order to create two buttons for different cards that give the user two options: "Happy" or "Sad".

defVar --name excelTableButtons --type DataTable
defVar --name createdCards --type List --innertype CardItem
defVar --name excel --type Excel
defVar --name languageUS --type Language
defVar --name selectedOption --type String
defVar --name result --type Boolean
//
// Access to data table with card information.
excelOpen --file "tableButtonsCards.xlsx" excel=value
excelGetTable --file ${excel} --getfirstsheet  --fromrow 1 --fromcolumn 1 --torow 3 --tocolumn 10 --hasheaders  excelTableButtons=value
mapTableToCard --dataTable ${excelTableButtons} --titleColumn column0 --subtitleColumn 2 --textColumn 3 --thumbnailUrlColumn 4 --actionColumn 5 --actionValueColumn 6 createdCards=value
// Mapping of cards and specification of their actions.
mapTableToCardButtons --dataTable ${excelTableButtons} --cardItems ${createdCards} --buttonActionColumn 7 --buttonTextColumn 8 --buttonValueColumn 9
//
createLanguage --culture "en-US" languageUS=value
botConnect --type "Chat" --language ${languageUS} --autoanswer  --timeout 00:05:00
    chatAskCarousel --text "Hello! What is your mood today?" --cards ${createdCards} --retry  --attempts 3 --retrytext "Excuse me, what is your mood today?" --timeout 00:05:00 selectedOption=value result=success
    botSay --text "Mood sent successfully!"
botDisconnect
logMessage --message "Carousel: ${selectedOption}" --type "Info"
Note:The Excel file in the example does not exist. You must provide the path to your own Excel spreadsheet file here. See Using cards in chatbot to learn more.