Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

StructIsEmpty function, help!

Community Beginner ,
Oct 22, 2013 Oct 22, 2013

I'm passing a structure to a function for req. fields validation but I first check whether or not my structure is empty.

If all element in my structure is empty I don't pass this structure to the validation function.

So I use StructIsEmpty to check my structure.

The problem is, when my Structure's elements contain only empty string, StructIsEmpty return "NO"

How can I have StructIsEmpty to return YES when all of the structure element is an empty string?

   <cfset st_MyStruct=StructNew()>

   <cfset st_MyStruct["InstType"]="#Trim(arr[112])#">    

   <cfset st_MyStruct["InstId"]="#Trim(arr[113])#">  

   <cfset st_MyStruct["PLN"]="#Trim(arr[115])#">    

   <cfset st_MyStruct["PFN"]="#Trim(arr[116])#">

   <cfset st_MyStruct["Referal"]="#Trim(arr[118])#">

 

   <cfif StructIsEmpty(st_MyStruct) NEQ "NO">

         <CFINVOKE component="cfcomponents.ValidateFields" method="CheckReqFields"

                                                                st_MyStruct="#st_MyStruct#"

                                                                Inst="#arguments.Inst#" >   

  </cfif>

TOPICS
Getting started
433
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2013 Oct 23, 2013
LATEST

<cfif NOT ( StructIsEmpty(st_MyStruct["InstType"]) AND

StructIsEmpty(st_MyStruct["InstId"]) AND ........................

)>

     <CFINVOKE component="cfcomponents.ValidateFields" method="CheckReqFields"

                                                                st_MyStruct="#st_MyStruct#"

                                                                Inst="#arguments.Inst#" >  

</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources