How to check for the variable passed to a function inside a component

I'm trying to pass a variable to a function inside of a
component in a conditional statement.
How to check the existance of this variable inside the
function so that I can use the right <CFarguments>:
in aForm.cfm I have:
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="Min"></cfinvoke>
<cfset MCompIDs = ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(MCompIDs,attributes.CompID)>
<cfset isM = true>
<cfelse>
<cfset isM = false>
</cfif>
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="SMEnroll"></cfinvoke>
<cfset SM_CompIDs =
ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(SM_CompIDs,attributes.CompID)>
<cfset isSM = true>
<cfelse>
<cfset isSM = false>
</cfif>
<CFIF isSM>
<cfset temppath = frmcreator.buildFrm(isSMFlag=isSM)>
<CFELSE>
<cfset temppath = frmcreator.buildFrm(isMFlag=isM)>
</CFIF>
On aFormComp.cfc where the function is,
I checked the existance of isSMFlag this way and I got error
saying that :
Context validation error for tag CFARGUMENT.; The tag must be
nested inside a CFFUNCTION tag.
How can I properly check the existance of isSMFlag inside the
function so I can use the right cfarguments?
<CFFUNCTION NAME="buildFrm" access="public"
returntype="String" output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION>

<CFFUNCTION NAME="buildFrm" access="public"
returntype="String"
output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION>
NOT this way, that is for sure.
The <cfargument ...> tag is for defining the arguments
a function
accepts either optional or not, but they are not required.
Give this a
try to see the differences.
test.cfc
<cfcomponent>
<cffunction name="a">
<cfdump var="#arguments#">
</cffunction>
<cffunction name="b">
<cfargument name="foo">
<cfargument name="bar">
<cfdump var="#arguments#>
</cffunction>
</cfcomponent>
test.cfm
<cfset something = createObject("component","test")>
<cfoutput>
#something.a("blue","green")#
#something.b("blue","green")#
</cfoutput>
Not tested or debugged so watch out for typos.

Similar Messages

  • How to check for the sub folder in the document library Is already Exist using CSOM?

    Hi,
    My requirement is to create the  folder and sub folder in SharePoint document library. If already exist leave it or create the new folder and the subfolder in the Document library using client side object model
    I able to check for the parent folder.
    But cant able to check the subfolder in the document library.
    How to check for  the sub folder in the document library?
    Here is the code for the folder
    IsFolder alredy Exist.
    private
    string IsFolderExist(string InputFolderName)
    string retStatus = false.ToString();
    try
    ClientContext context =
    new ClientContext(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryLink"]));
                context.Credentials =
    CredentialCache.DefaultCredentials;
    List list = context.Web.Lists.GetByTitle(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryName"]));
    FieldCollection fields = list.Fields;
    CamlQuery camlQueryForItem =
    new CamlQuery();
                camlQueryForItem.ViewXml =
    string.Format(@"<View  Scope='RecursiveAll'>
    <Query>
                                            <Where>
    <Eq>
    <FieldRef Name='FileDirRef'/>
    <Value Type='Text'>{0}</Value>
                                                </Eq>
    </Where>
    </Query>
                                </View>",
    @"/sites/test/hcl/"
    + InputFolderName);
                Microsoft.SharePoint.Client.ListItemCollection listItems = list.GetItems(camlQueryForItem);
                context.Load(listItems);
                context.ExecuteQuery();
    if (listItems.Count > 0)
                    retStatus =
    true.ToString();
    else
                    retStatus =
    false.ToString();
    catch (Exception ex)
                retStatus =
    "X02";
    return retStatus;
    thanks
    Sundhar 

    Hi Sundhar,
    According to your description, you might want to check the existence of sub folder in a folder of a library using Client Object Model.
    Please take the code demo below for a try, it will check whether there is sub folder in a given folder:
    public static void createSubFolder(string siteUrl, string libName, string folderServerRelativeUrl)
    ClientContext clientContext = new ClientContext(siteUrl);
    List list = clientContext.Web.Lists.GetByTitle(libName);
    CamlQuery camlQuery = new CamlQuery();
    camlQuery.ViewXml =
    @"<View Scope='RecursiveAll'>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name='FSObjType' />
    <Value Type='Integer'>1</Value>
    </Eq>
    </Where>
    </Query>
    </View>";
    //camlQuery.FolderServerRelativeUrl = "/Lib1/folder1";
    camlQuery.FolderServerRelativeUrl = folderServerRelativeUrl;
    ListItemCollection items = list.GetItems(camlQuery);
    clientContext.Load(items);
    clientContext.ExecuteQuery();
    Console.WriteLine(items.Count);
    if (0 == items.Count)
    //create sub folder here
    Best regards
    Patrick Liang
    TechNet Community Support

  • HOw to check for the Child Elements USing only SAX Parsr?

    HI Guyz,
    How to check whether there are any Child Elements in an XML file using ONLY SAX parser ??? I have a requirement of checking first whether there is any Child Elements exists for a Element or not and based on that I have to take certain actions. Can anyone suggest me How to do that ???
    Thanx
    KK

    Since SAX is event controlled, you wont know if there's a child element unless you actually bump into it with the Parser. You'll simply get another startElement event after your current one.
    /Tom

  • How to check for the prerequisite Support pack level

    We are planning to upgrade from 4.7 to ECC6..How can check ,what is minimum support pack level that needs to be maintained in 4.7 for the upgrdade to ECC6.
    Can i check this in Servrice markrt place .if so please let me know where to check
    Thanks

    Hello,
    I am sure you will find relevant information in the link below.
    https://websmp207.sap-ag.de/upgrade
    Regards,
    Manoj Chintawar

  • How to check, when the Maintenance Order was deleted

    Hello Experts,
                          Can you please tell me of how to check for the maintenance order that when it was deleted and who has deleted that.
    If any T-Code is there or at the Table level also to check the requirement.
    Regards,
    Yawar Khan

    If you want to track when you have put deletion flag, you can track it using above mentioned techniques.
    If you archived (deleted) permanently, then using archival history only, you can check I guess.
    Check these links. While deleting maintenance order, we can hisorical order with same number. Using that creation date, you can track.
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/3e6552462a11d189000000e8323d3a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/3e4d2f462a11d189000000e8323d3a/frameset.htm

  • Checking for the existence of a Frame

    Hello,
    I am currently designing an application which consists of 8 JFrames (all in different classes), During the application, one JFrame provides information to a user and when they select the appropriate fields another JFrame opens an the active one closes. However the problem i am having is that i need to be able to write an if statement saying
    if (this particular frame exists already){
    destroy it;
    }else{
    whatever........};
    But i dont know how to check for the existence of a frame currently running, or how to destroy it..
    im currently using dispose(); to destroy frames but the dispose method only works when your in the class thats creating the frame, it wont let me write something like class1.dispose() (where class1 is the frame object created in the constructor of class1.java); in class2.
    I have searched throught the forum and havent found anything that can help me, i would really appreciate anyones input.
    Thanks in advance,
    Dev

    Hey its ok i've decided to restructure the program, but if anyone does know how to do this please still reply to the message, as i would still like to know

  • How to check for locks on a table inside a program?

    Hi Gurus,
    Kindly let me know how to check for a lock on a particular table inside a program.I know that we can see locks on table held by a user from transaction SM12 but my requirement is to check for lock on MARA/MARC/MARV if lock exist then bypass my code else do the code.
    Kindly suggest or give code to check for a lock on a particular table.
    Thanks in advance
    Sudipto

    FAQ.  Locked.

  • How can I check for the existence of an XML file in Illustrator Javascript??

    I'm writing a Javascript to run at startup. I want to check for the existence of XML files and process them, if they are available. How can I check for their existence?

    Your first line just sets a variable to a string value… getFiles() is a method of Folder… so
    var InputXMLDir = Folder( "D:/Brackets/Create_Bracket_Graphics/Input/XML-n-Templates/" );
    Not a PC user so I can't remember if the colon is OK…? As you appear to know the file name why bother with a folder get files anyhow you could just check if the file exists then do some thing…
    alert( File( "D:/Brackets/Create_Bracket_Graphics/Input/XML-n-Templates/brackets_men_web.xml" ).exists );

  • How to check for missing fields in the file?

    Hi friends,
    I have a file to file scenario in which if any of the fields have a blank value, i have to put the file back in the source folder. If none of the fields are missing, the scenario should work normally.
    Can anybody tell me <b>how can i check for the field lengths</b> and if any of the fields are blank, <b>how do i send it back to the original folder.</b>
    Waiting for your responses,
    Divija.

    Hi Divija,
    >><i>how can i check for the field lengths</i>
    Since you need to basically check if the field has a value or not, i dnt think you need to check for the length of the field. Instead, you can use any one of the booloean functions available in the graphical mapping editor to check if the field has a value or not(filed value true or false)
    >><i>how do i send it back to the original folder.</i>
    You can maintain a flag variable in the target structure such that if any of the source fields donot have values, the flag's value becomes 1 else it remains 0.
    Now, you can check if the value of flag is equal to 1/0 in the bpm and accordingly send the data.
    If in case, you donot want the flag to come in the target file that is loaded/sent from the bpm in the end, i think even tat can be taklen care of.
    You can create two receiver communication channels and define one file adapter in each such that one has the destination as the actual target directory and the other has the original source directory as the destination.
    Regards,
    Sushumna

  • I need to verify my Apple ID. i know my e-mail address and the password, but what websit do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

    i know my e-mail address and the password, but what website do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

    i know my e-mail address and the password, but what website do I go to to check for the e-mail. I have a older laptop and my iTunes is 9.1.1 or something and Apple 10.4.11 so how do I do this. Thanks.

  • I just buy iPhone4 first hand on Jan 07,2013 but the warranty expire date How can i check for the date of production?

    I was bought iPhone4 16 GB on Jan 07, 2013 from online shop from Laos they told me that this iPhone from Apple in Hongkong (first hand) but I check for the warranty is already expire date. What should we do? I want to know about my iPhone4 first hand or second hand. How can i check?

    This will show you warranty status and give you an idea
    of when originally sold:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How to check for latest Apps in the App Store

    Is there a way to check for the latest apps. I only see options to sort by name and by best-sellers. If there is no way how can i request this feature. Thanks.

    As I understand the Mac App Store, that sort is already done for you in Features. The first category on the Features page is New and Noteworthy, with the link to See All.
    Dah•veed

  • HT4623 How long does it take to check for the new update?

    My iPod cannot check for the update.
    Normally how long does it take to check for the new update??

    How are you Checking for Updates...
    JinMoo wrote:
    My iPod cannot check for the update.
    What happens when you try... Any Error messages or Alerts...

  • How to check for a  button

    I have a form that submits to itself. My submit is the
    standard :
    <input type="submit" name="btnsubmit" value="Submit Your
    Order">
    When the form is submitted, I check for the existence of
    btnsubmit using paramerexists or isDefined :
    <cfif parameterexsits(btnsubmit)>
    perform inserts, etc.
    </cfif>
    This works fine. But my question is what do I do if the
    type=button instead of submit ? For example
    <input type="button" name="btnSubmit" value="Submit Your
    Order">
    I have some javascrpt validation that will submit the form
    when the button is clicked. Howver, how do I determine whether the
    button was seleceted or not, so that I can do my processing
    (insert, etc. ) ? I tried to use the isDefined or parameterexists
    like before but that does not work ?
    What is the command to check that a button was selected
    ?

    Assuming your <input> button is inside of the form you
    are submitting,
    simply use
    <cfif isDefined('form.btnSubmit')>
    However - some browsers only pass the button value if that
    particular
    button is clicked.
    In other words, hitting 'enter' in another field of the form
    may not
    pass in the submit button value as part of the form scope. In
    this case
    you'd want to check for another one of the form variables,
    ideally a
    required field.
    trojnfn wrote:
    > I have a form that submits to itself. My submit is the
    standard :
    > <input type="submit" name="btnsubmit" value="Submit
    Your Order">
    >
    > When the form is submitted, I check for the existence of
    btnsubmit using
    > paramerexists or isDefined :
    > <cfif parameterexsits(btnsubmit)>
    > perform inserts, etc.
    > </cfif>
    >
    > This works fine. But my question is what do I do if the
    type=button instead of
    > submit ? For example
    > <input type="button" name="btnSubmit" value="Submit
    Your Order">
    >
    > I have some javascrpt validation that will submit the
    form when the button is
    > clicked. Howver, how do I determine whether the button
    was seleceted or not, so
    > that I can do my processing (insert, etc. ) ? I tried to
    use the isDefined or
    > parameterexists like before but that does not work ?
    >
    > What is the command to check that a button was selected
    >
    Michael Evangelista, Evangelista Design
    Web : www.mredesign.com
    Forums: news://forums.mredesign.com
    Blog : www.miuaiga.com

  • How can i view the variables of the session memory

    Hi experts
       How can i view the variables of the session memory.Such as I want display the variables of memory which id is 'BULRN' in ABAP debug.
    In program i can use import from memory id visit the momery of session,but i don't know the name of variables which store in momery of my session.

    Its not possible to view in the debug mode..
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens
    SAP global memory retains field value through out session.
    set parameter id 'MAT' field v_matnr.
    get parameter id 'MAT' field v_matnr.
    They are stored in table TPARA.
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data
    to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
    ABAP memory is temporary and values are retained in same LUW.
    export itab to memory id 'TEST'.
    import itab from memory Id 'TEST'.
    Here itab should be declared of same type and length.

Maybe you are looking for

  • My Powerbook G4 refuses to recognise it's battery.............

    My powerbook refuses to recognise that it has a battery installed. Naturally this happened just weeks after the extended warranty ran out! The battery icon on the top right side of the toolbar has a cross in it and yes, I have checked it with another

  • Return to store from production quality

    hi, There is a problem , i have a senario suppose some raw material is left in production then we have to return to store , so the stores people check that material Inspection plan is already maintained with usages 5 and status 4 (inspection lot is g

  • Solstice Backup and Solaris 8 Upgrade

    I currently have Solstice Backup v5.0.1, patched with 105658-05 on Solaris 2.6. When I upgrade to Solaris 8, do I reinstall Solstice Backup v5.0.1 or will I have to upgrade it too? Thanks

  • How can update my class instance at runtime?

    What would happen if at runtime I update a class file? Will the JVM know to use that instead? How can I use the updated class at runtime? Who can give me an example? thanks all!

  • Issues with Logic 9

    1) Frontier Designs Alpha Track would not work at first. Fixed this. 2) Mouse scroll ball will not work in EQ anymore? Anyone seeing this? I used this alot to tweak the Q and dB values without dragging. 3) Drum replacment enhancement is always greyed