Passing null/empty values from a actionscript VO to a Coldfusion ORM object

This is the situation.
If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
For instance, if you have the following actionscript VO:
package vo
    [RemoteClass(alias="com.companyname.Person")]
    [Bindable]
    public class Person
        public var person_id:Number;
        public var last_name:String;
        public var first_name:String;
        public var email:String;
        public var created_date:date;
     public function Person() {}
And you have the corresponding Coldfusion component:
<cfcomponent displayname="person" output="false"
    alias="com.companyname.Person"
    schema="dbo" persistent="true"
    table="PERSON">
    <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
    <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
    <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
    <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
    <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
</cfcomponent>
Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
Have other people encountered this problem?  How have you gotten around it?  Thanks.

I realize that I didn't clarify that I am using ColdFusion
for getting the data. This class was generated by the Create CFC
wizard in Flex Builder.
package com.generated
[Managed]
[RemoteClass(alias="components.generated.clients.Clients")]
public class Clients
public var clientid:Number = 0;
public var clientfirstname:String = "";
public var clientlastname:String = "";
public var clientaddress1:String = "";
public var clientaddress2:String = "";
public var clientcity:String = "";
public var clientstate:String = "";
public var clientzip:String = "";
public var clientphone:String = "";
public var clientemail:String = "";
public function Clients()
}

Similar Messages

  • Passing null/empty values from Flex to a Coldfusion ORM object

    This is the situation.
    If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
    For instance, if you have the following actionscript VO:
    package vo
        [RemoteClass(alias="com.companyname.Person")]
        [Bindable]
        public class Person
            public var person_id:Number;
            public var last_name:String;
            public var first_name:String;
            public var email:String;
            public var created_date:date;
         public function Person() {}
    And you have the corresponding Coldfusion component:
    <cfcomponent displayname="person" output="false"
        alias="com.companyname.Person"
        schema="dbo" persistent="true"
        table="PERSON">
        <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
        <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
        <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
        <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
        <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
    </cfcomponent>
    Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
    There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
    Have other people encountered this problem?  How have you gotten around it?  Thanks.

    Looks like a known workaround to this issue is to wrap the Flex object in an array.
    The ColdFusion CFC will accept that as an array, with the first an only element being a struct, which is the object you built in Flex.

  • Passing multiple character values from parameter form to PL/SQL

    Hi,
    I am passing multiple character values from parametr form into
    the report query and a PL/SQL procedure. It works fine with the
    query, when I use &variable. But, it doesn't compile in PL/SQL,
    so I just used the :variable, but not getting any records in the
    PL/SQL procedure. Any suggestions?
    sincerely,
    gj

    gj / Fedro,
    Only using the &referecne, you can pas a string / multiple character values and this would work for query only.
    The bind parameter in PL/SQL wouls support only single value
    Thanks
    The Oracle Reports Team

  • Is it possible to pass a formula value from a sub-report to a main report

    Hi there,
    Im trying to pass a formula value from a Sub-report back upto into my Main report but the value doesnt seem to be getting passed up. Ive tried it the other way around, that is, passing a value from the main report to the sub-report and that works fine.
    Below is an example of what I am trying to do but it is not working. In my sub-report Ive declared a formula variable as,
    formula name=main_subIntRatePageCount
    Shared NumberVar subIntRatePageCount := TotalPageCount;
    and in the Main report Ive declared the formula variable as,
    formula name=subIntRatePageCount
    Shared NumberVar subIntRatePageCount;
    subIntRatePageCount;
    I want the value assigned to "subIntRatePageCount" in my Sub-Report to be available to my Main report.
    The problem I am trying to solve is that the sub-report is spilling over onto two pages, and I need a way of updating the page display on the main report to reflect this. The page display is of format, "displaying page 1 of  3", but its not taking into account the extra page produced by the sub-report, so it should say "displaying page 1 of 4".

    Also thanks Raghavendra, Asha,
    I've tried adding the "whileprintingrecords" statement but that doesnt seem to make any difference.
    I notice that the subReport is being called from my the GroupFooter section of the main report, and I am trying to reference the variable in the main repot in the Page Footer section. Could it be that the variable hasnt been calculated in the Page Footer by the time I calculate it in sub-Report? I thought Crystal Reports does at least 5 passes over the report evaluating all the formulas before it prints the report?
    The problem Im trying to solve is I need to know how many pages my report will have before its completed, so that i can print the statement "displaying page 1 of X", and X is currently not being calculated correctly because the sub-report is printing onto 2 pages and not 1 so the report thinks I have 1 of X pages and not X+1.
    Regards
    Robert.

  • Passing global variable values from databse to forms

    I am using forms 6i and database is oracle 9i.
    I am trying to run a form stand alone ( by pressing CTRL-R) without putting it in the application.
    since when this form is placed in the application menu it works fine as it has been passed global variables values from the database .
    now i am trying to run the form without menu and thus i want to pass the values of global variables .please let me know where should i pass these values in form .is it be WHEN-NEW-FORM-Instance trigger or in Pre-form trigger.
    i know what are the global variable values passing into the form from database.
    i can hard code any values to check if the form runs well or not.

    If you intend to do this sort of testing regularly you might want to consider creating a seperate form with a control block which allows entry of the name of the form you want to run, the names of the globals and their values, and do a CALL_FORM.

  • Remove null & empty values

    I created a report with multiple fields. I would like to create a generic formula in which it evaluates all the values and if it found a null or empty value it will be replaced by a 'N/A'. I was searching in the forums and I found the following formula
    if  (isnull() or ( ='')) then
           "Display the required text"
    else
    when I tried to use it i had an error that the value must be boolean. Is there is a way where  I can change all the fields as string?? and a assign "N/A"
    or
    how can I assign a "N/A"to a boolean field??
    also  I have approx. 140 fields to evaluate, does the formula can be generic or I will need to create a formula for each variable??
    thanks

    Usually when Crystal runs across a field that is NULL, it immediately stops executing the formula, unless the field is enclosed within IsNull().  However, I'm not sure if that is the case for a parameter being passed to a function.  So, you may be able to create a function like (Formula Workshop -> Create Custom Functions -> Add; basic syntax):
    function DisplayString (inVal as string) as string
    if (isnull(inVal) or (inVal ='')) then
      DisplayString = "N/A"
    else
      DisplayString = inVal
    end if
    If Crystal does stop when passing a NULL value as a parameter, then you could code a similar function (without the isnull()), and check the Convert NULL Database Values to Default option on the File -> Report Options panel.
    You would need to create one such function for each data type that you want to show "N/A" for, and for data types other than string, convert the value to a string when it is not null.
    These functions could then be used in the Display String formula for the field on the report.
    The only other way I can think of achieving this would be to base the report(s) on an SQL Command and convert NULL values to "N/A" there.  It might be a bit easier to do in an SQL Command, but probably not a whole bunch.
    Or, educate your users that when nothing is printed, it means that it's not applicable! 
    HTH,
    Carl

  • How can I pass a variable  value from first jsp page to thired jsp page

    In my program ,threr are three jsp pages . I want the first pages's variable value in to thired page .How can I acess.
    I used the request.getparameter() ,but when I print the value , null value is getting .

    request parameters only last for one request.
    To save them longer than that you need to save them somewhere.
    Couple of alternatives
    1 - store them to session
    session.setAttribute("username", request.getParameter("username");
    2 - create a hidden field on page 2 and store the value from page 1 there. When you submit page2, you can get it on page3 with request.getParameter again.
    <input type="hidden" name="username" value="<%= request.getParameter("username") %>">

  • RRI - Jump query, unable to pass the variable value from source to target

    Hi,
        I've a source query which has a variable on 0vendor, from this query i jump to another query for which i want to pass the this variable value, in the target query i've vendor in free characteristics (no filter or variable in there), and in RSBBS i tried the assignment details options keeping vendor as generic, tried variable and the variable name but nothing seem to work.
    But when query is run i can jump into target query but the vendor variable value doesnt get passed thru the values i get in target query is for all rather than for the variable entered vendor value in the source.
    btw we're in NW2004s.
    any help appreciated with points.
    thanks
    Mayil

    Anyways, I read somewhere that a variable with replacement path in target query would work, tried it seem to work.
    let me know if there other way to do it without creating a variable in target query.
    thanks
    mayil

  • Passing Multiple Single Values from Sender Query to Receiver Query in RRI

    Dear All.
    We have 2 - Bex Reports ZBEX_1 & ZBEX_2
    1. In ZBEX_1 having the fileds data like the below.
    Account Doc. Number - Clearing Document --- Amount
    12345                  -  65432                --- 100
    12346                  -  54321               ---  50
    2. In ZBEX_2 having the following data.
    Account Doc.Number -- Amount
    45342                     - 10
    66666                        -  100
    65432                       -   10
    54321                      - 5
    3. I am Traying to create RRI Between ZBEX_1 & ZBEX_2 , with Sender query as ZBEX_1 and Receiver query as ZBEX_2
    If I drilldown from ZBEX_1 need to show the following output in the ZBEX_2
    Account Doc. Number  -  Amount
    65432                       -     10
    54321                      -     5
    i.e If Clearing Documnet in the ZBEX_1 is same as Account Doc. Number in ZBEX_2 those Account Doc. Numbers I have to show in the output of ZBEX_2 RRI Report.
    Both the records I have to show at a time.
    So please suggest me
    1. How to pass Multiple Single Values to Next Query using RRI
    2. How to Map Clearing Document to Account Doc. Number in RRI.
    NOTE: Account Doc. Num length is same as Clearing Document
    Please suggest me.
    Thanks & Regards,
    Kiran Manyam

    Your scenario of passing values from multiple records in Source does not suit well for RRI Jumps.
    In ZBEX_2 query, create a Replacement path variable on Clearing Document. In that Replacement path variable, use the Replacement with query option and choose the ZBEX_1 as the underlying query source.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bd/589b3c494d8e15e10000000a114084/frameset.htm
    When you execute ZBEX_2, what ever clearing document values that ZBEX_1 has will be passed through the replacement path variable as a filter to the ZBEX_2
    Hope it helps!
    Uday Pothireddy

  • Passing array of values from front panel to menu

    I am working with a group programming a multichannel current stimulation device and we are currently having trouble setting up the run time menu. The burning question that we have is trying to figure out how to pass an array of values from the front panel to the menu that we are setting up in the block diagram, any advice?
    Thank you

    Take a look at this. Its just a simple menu update using a for loop. Uses whatever your values are as the item tag and item names. Remember, item tags need to be unique. This specifically goes under the sub menu of channel, which has to be created before.
    Attachments:
    menu.vi ‏12 KB

  • Query regarding passing of flag value from one component to another.

    Hi all,
        I need to pass a flag value of type CHAR1 from one view of one component to another view of a different component. Any ideas?

    Hi,
    You can use the Global Data Context Parameters which you can define in SPRO->IMG->CRM->UI Framework->Tech Role Def->Define Global Data Context Parameters.
    You can set the value wherever you want and read the same in the other component using the below similar code.
    * Setting the value using GDC
      CALL METHOD lr_gdc->set_data_attribute
        EXPORTING
          i_value = value
          iv_name = 'ZSTARTDATE'.
    *Reading GDC data
    DATA: lr_gdc       TYPE REF TO if_crm_ui_data_context.
    lr_gdc = cl_crm_ui_data_context_srv=>get_instance( me ).
                CALL METHOD lr_gdc->get_data_attribute
                  EXPORTING
                    iv_name = 'ZSTARTDATE'
                  IMPORTING
                    e_value = lv_sdate.
    * Here ZSTARTDATE is the GDC parameter defined in spro
    Hope it would be helpful
    Regards,
    Shobhit

  • How to trap null return values from getters when using Method.invoke()?

    Hi,
    I am using Method.invoke() to access getters in an Object. I need to know which getters return a value and which return null. However, irrespective of the actual return value, I am always getting non-null return value when using Method.invoke().
    Unfortunately, the API documentation of Method.invoke() does not specify how it treats null return values.
    Can someone help?
    Thanks

    What do you get as a result?I think I know what the problem is.
    I tested this using following and it worked fine:
    public class TestMethodInvoke {
    public String getName() {
    return null;
    public static void main(String args[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Object o = new TestMethodInvoke();
    Class cls = o.getClass();
    Method m = cls.getMethod("getName", (Class[]) null);
    Object result = m.invoke(o, (Object[])null);
    if (result == null) {
    System.err.println("OK: Return value was null as expected");
    else {
    System.err.println("FAILED: Return value was NOT null as expected");
    However, when I use the same technique with an EJB 3.0 Entity class, the null return value is not returned. Instead, I get a String() object. Clearly, the problem is the the EJB 3.0 implementation (Glassfish/Toplink) which is manipulating the getters.
    Regards
    Dibyendu

  • How do I pass a field value from one form to another?

    Hi,
    Please help me.
    First application.
    I have login form.
    One field P48_USERNAME, no password required.
    Enter the User name and press Login button.
    The Login redirects to page 4.
    On Page 4, I need to populate a hidden field called user with the value from P48_USERNAME.
    How can I do this?
    Apex version - Application Express 4.0.2.00.07
    Zac

    Hi Ola,
    What do you have to in the taget page the branches alone does not work.
    No password is required, no password is entnered, no field available to enter a password.
    Any any ideas?
    Zac

  • How to pass Presentation Variable Value from Main Report to Detail Report

    Hello,
    I've 2 reports that is attached to each other. In my main report i've several report prompts and i am using i"s prompted" on my detail report to attach them.
    But 2 of my report prompts are presentation variables(Names : FIRST, SECOND). Both are in date format. I've a filter in my main report like;
    "ASSIGNMENTS_F"."EFFECTIVE_START_DATE" BETWEEN @{FIRST} AND {SECOND}
    It works fine when i run the main report. But when i click on the numbers, i see that i can not filter my detail report with the chosen values for 2 presentation variables. It just shows all the dates.
    I've tried adding both presentation variables in both reports as columns and adding 'is prompted' filter to them. But did not work either.
    I just cant pass the written values for presentation variable prompts to detail report..
    Please help :)

    Hi,
    What you can try is refer the filte condition in the main report to the detailed report with the option--> Filter based on another request.
    Or you try creating another intermediate report which will refer the main report filters and pass the filters to the detailed report.
    Hope this helps.
    Regards
    MuRam

  • Retrieving empty values from multi value string in user profile custom properties

    Hi,
    I created a webpart to save and retrieve data from custom properties. I use the code below to get the stored data:
    for (int i = 0; i < profile[property].Count; i++)
    Item = profile[property][i] == null ? string.Empty : profile[property][i].ToString();
    list.Add(Regex.Split(Item, @"\,\#"));
    Nothinig special about it.
    In my development environment, it works fine. The problem is  in my UAT environment. I'm facing an issue that i hope someone has been through. When the custom property is a multi value string type, it returns a empty string. I tested with HTML and single
    value fields and it works fine.
    Independently of the field type, it saves the data all right.
    Can anyone help me?
    Thanks!!

    Thanks, Chitvan Jain.
    I did as you suggested, but nothing changed. The problem is that profile[propname] comes already blank when using multi value property, even if there is data  to be retrieved.
    One funny thing is that, somehow the code manages to count the number of values there is in the property. Only the data is missing. We can see the exact number of column, cause i check if there's the right number of data, if there isn't, i add up  a empty
    string on the grid cell, but only for viewing. The empty string is not stored in the property.

Maybe you are looking for

  • Can't connect macbook pro to internet with airport extreme

    Can't connect macbook pro to internet with airport extreme

  • How to change the SIZE FONT of the text description in ESS

    Hi Forum    My key user wants the size font  more bigger in the areas and subarea´s of ESS. I have changed then font of the standard text in the Theme Editor. I think that this is a property in the Web Dynpro Application and only modifying it this co

  • Anybody having probs w/extremely long synchs?

    I lost my 1G Nano 2 weeks ago, two days before the 2G Nano's went on sale, so I bought one. Did the "upgrade" to iTunes v7 (and subsequently v7.0.1) and have also updated my Nano firmware to 1.0.2, so I think I'm running the latest versions. I am, ho

  • PURCHASE ORDER - "PER" FIELD

    Dear, I am located in Brazil, I use the MM functional analyst version ECC 6.0. I would like to know more about the field "PER" where used here after the withdrawal of tax on gross prices. In this field we (1,10,100 or 1000) to the net to beat the pri

  • I5Grid is not rendering

    I created i5Grid, but it is not rendering. It suppose to show LotID, MaterialName, HoldStatus, QuarantineStatus, StartDate, EndDate/