<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to apply validation on excel sheet fields</title><link>https://community.appian.com/discussions/f/user-interface/13981/how-to-apply-validation-on-excel-sheet-fields</link><description>Hi, 
 I&amp;#39;m using readexcelsheet() so my question is how to apply validation on particular field in excel sheet. Can anyone suggest me how to validate it?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63508?ContentTypeID=1</link><pubDate>Tue, 18 Dec 2018 12:19:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f9486d95-4993-4b41-b9fd-7477f1780868</guid><dc:creator>deviratnamv</dc:creator><description>Thank you Thasneem Nisa, It&amp;#39;s working fine.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63506?ContentTypeID=1</link><pubDate>Tue, 18 Dec 2018 09:11:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b62b8fb3-472d-42f3-aedc-46a076749a52</guid><dc:creator>mohamedt808</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;you can perform a certain amount of validation on file properties within the upload interface using fv!file.(properties). Refer &lt;a href="https://docs.appian.com/suite/help/18.4/File_Upload_Component.html"&gt;here&lt;/a&gt;&amp;nbsp;for some examples. For validation on data, you can perform the validation on file submission and display them back on the same interface with relevant validation messages, passing them as an input to the interface,&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Thoufiq.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63505?ContentTypeID=1</link><pubDate>Tue, 18 Dec 2018 09:10:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7b09150-4caa-4dbb-8bb8-f868c129b6d6</guid><dc:creator>Thasneem Nisa </dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Once the excel is uploaded and form been submitted, call the main rule provided above in a script task and store the o/p in a variable ( For Ex: validations[List of Text]). Next to script task have an XOR and check whether the variable is empty. If empty, then proceed with other operations. If there are some errors, then re-direct to UIT. In the interface, add a rule input for validations and insert below field&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!richTextDisplayField(
  showWhen: not(
    isnull(
      ri!validations
    )
  ),
  value: a!richTextBulletedList(
    items: a!forEach(
      items: ri!validations,
      expression: a!richTextListItem(
        text: a!richTextItem(
          text: fv!item,
          color: &amp;quot;NEGATIVE&amp;quot;
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63501?ContentTypeID=1</link><pubDate>Tue, 18 Dec 2018 08:55:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c9832b79-89d2-4a8b-8f96-00f8cca0bd0e</guid><dc:creator>deviratnamv</dc:creator><description>How to display validation message at the time of uploading excel document?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63426?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 11:51:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d721de19-5b8b-41f2-bf1d-db21bad33fb8</guid><dc:creator>deviratnamv</dc:creator><description>Thank you Thasneem Nisa, I will try.......&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63425?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 11:37:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b0e798b4-9952-43fd-87c0-a7f6cce21915</guid><dc:creator>Thasneem Nisa </dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/deviratnamv"&gt;deviratnamv&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Following rules will help you to validate data retrieved from readexcelsheet(). Please note that I have handled most possible cases of excel validation. You might have to add logic to handle your application-specific use cases for each cell data.&lt;/p&gt;
&lt;p&gt;Code for TEST_getExcelValidations() &amp;lt;&lt;strong&gt;Master Rule&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;with(
  local!excelData: rule!TEST_readExcelSheet(
    document: ri!document,
    sheetNumber: 0,
    startRow: 1,
    numberOfColumns: 17
  ),
  rule!TEST_checkIfExcelDocumentHasValidData(
    excelData: local!excelData
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Code for TEST_readExcelSheet()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;with(
  local!excelData: readexcelsheet(
    ri!document,
    ri!sheetNumber,
    ri!startRow,
    ri!numberOfColumns
  ),
  if(
    toboolean(
      local!excelData.success
    ) = false(),
    null,
    remove(
      local!excelData.result,
      where(
        a!forEach(
          items: local!excelData.result.values,
          expression: length(
            fv!item
          ) = 0
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Code for&amp;nbsp;TEST_checkIfExcelDocumentHasValidData()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  isnull(
    ri!excelData
  ),
  {},
  with(
  /*Removing header row from the retrieved data. Write separate rule to validate header row if needed*/
    local!dataFromExcel: index(
      remove(
        ri!excelData,
        1
      ),
      &amp;quot;values&amp;quot;,
      null
    ),
    if(
      isnull(
        local!dataFromExcel
      ),
      &amp;quot;All the cells cannot be empty.&amp;quot;,
      reject(
        fn!isnull,
        rule!TEST_validateEachRow(
          dataFromExcel: local!dataFromExcel,
          userName: ri!userName
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Code for&amp;nbsp;TEST_validateEachRow()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!flatten(
    a!foreach(
        items:ri!dataFromExcel,
        expression:{
        /**Add Validation rules as per your need and call those here**/
        /*I have passed rowNumber, cellName as inputs to construct the error message to user*/
            rule!TEST_validateTextCell(
                isRequired:true(), 
                cellName:&amp;quot;First Column Name&amp;quot;, 
                rowNumber:fv!index+1,
                cellData:index(
                    fv!item,
                    1,/*1 specifies column number to validate*/
                    null
                )
            ),
            rule!TEST_validateIntegerCell(
                isRequired:true(), 
                cellName:&amp;quot;Second Column Name&amp;quot;, 
                rowNumber:fv!index+1,
                cellData:index(
                    fv!item,
                    2,/*Passing 2nd column data to validate*/
                    null
                )
            )
        }
    )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Logic behind TEST_validateTextCell() or&amp;nbsp;TEST_validateIntegerCell()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
    ri!isRequired,
    if(
        isnull(
            ri!cellData
        ),
        &amp;quot;Row Number: &amp;quot;&amp;amp;ri!rowNumber&amp;amp;&amp;quot; has no data for &amp;quot;&amp;amp;ri!columnName&amp;amp;&amp;quot; column&amp;quot;,
        if(
            ri!cellData&amp;lt;=0,
            &amp;quot;Row Number: &amp;quot;&amp;amp;ri!rowNumber&amp;amp;&amp;quot; has 0 or lesser than 0 for &amp;quot;&amp;amp;ri!columnName&amp;amp;&amp;quot; column. Only positive values allowed.&amp;quot;,
            {} /*I have validated for positive number*/
        )
    )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63424?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 11:16:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5682c8ef-43ac-4f19-a68e-35ddf3973915</guid><dc:creator>mohamedt808</dc:creator><description>Hi, &lt;br /&gt;
&lt;br /&gt;
I am guessing you would like to vlaidate certain fields in your excel,  lets say want to ensure certain headers are present . You can achieve this by using Read Excel Cell by Name() or Read Excel Cell by Number() function and extract the value first, validate the data in Appian and proceed with reading the entire file using readExcelSheet.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to apply validation on excel sheet fields</title><link>https://community.appian.com/thread/63422?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 11:15:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3c6bb82-cbd0-4474-82e6-f01e277769c0</guid><dc:creator>vijay</dc:creator><description>Hi Devi Ratnam,&lt;br /&gt;
&lt;br /&gt;
Please check the option Data Validation under the Data menu in excel file. By using this we can restrict the user from entering inappropriate data as per our need. Hope may help this.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Vijay&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>