Retrieving a DefaultValue from an external datetime

 I've been doing this for a while now, and everytime I try to make a DefaultValue get a value from an external source (another DataObject), it works fine. Except when I try to get the value from a datetime object. For some reason, it sets the date to 12/31/1969.

 

{@<projectname>.<dataobjectname>:Field[<Datefieldname>].Value}

 

The formatting on both fields (the one from the external dataobject, and the on I'm trying to set the defaultvalue) are identical (%m/%d/%Y).

Anyone knows whats wrong?

I did some debuggin. The

I did some debuggin.
The field is indeed returning a string. I created another function to convert it to a date, using the default datetime stamp, and the field still bugs when I try to set it.
My guess is that Datetime controls cannot be set by any means other than manually, at runtime.

What happens when I try to send a datetime stamp is that it writes on the field as if I was passing a string, but does not set the calendar on the side and does not use the formatting specified on the "Format" field, which means I can't use it.

Any thoughts?

Thanks.

Do you mean the value can be

Do you mean the value can be set, but the data format is not right so that the calendar won't popup correctly?

- support

It doesn't matter which

It doesn't matter which format it goes, the value is set as '12/31/1969'. Already tried 'yyyy-mm-dd HH:nn:ss', the american format, the format without the hour and, those same with '/' instead of '-' and a few others, nothing worked. It always goes as 12/31/1969.

 

I just changed all the datetime controls of my forms (a lot of em) to textboxes, and used a javascript function to format it.

 That's my VW_ATENDIMENTOS,

 That's my VW_ATENDIMENTOS, so you can understand what I'm doing:

 
<ControlList>
<Control Form="cras.Tabs" Name="tabs"/>
<Control Form="cras.FM_ATENDIMENTOS" Name="fmatendimentos" SubCtrls="cras.FM_BENEFICIOSPessoas_Sub"/>
<Control Form="cras.Subtabs_Atendimentos" Name="_subtabs"/>
<Control Form="cras.FM_BENEFICIOSPessoas_Sub" Name="fmbeneficiospessoas"/>
</ControlList>
 
As you can see there, I'm listing two forms on the same page. One of them (FM_ATENDIMENTOS) is linked to DO_ATENDIMENTOS.xml, and the other one (FM_BENEFICIOSPessoas_Sub) is linked to DO_BENEFICIOS.xml. They're all inside the folder "cras".
 
From DO_ATENDIMENTOS.xml:
 
<BizField Column="DATA" Format="%d/%m/%Y" Name="data" Required="Y" Type="Datetime" Value=""/>
 
From DO_BENEFICIOS.xml:
 
<BizField Column="DATA" DefaultValue="{@cras.DO_ATENDIMENTOS:Field[data].Value}" Format="%d/%m/%Y" Name="data" Type="Datetime" Value=""/>
 
Notice that the following line works as intended, also on DO_BENEFICIOS.xml: 
 
<BizField Column="PESSOAS_ID" DefaultValue="{@cras.DO_ATENDIMENTOS:Field[pessoa_id].Value}" Name="pessoas_id" Type="Text"/>
 
My theory is that Field[data].Value's returning a string, instead of a datetime stamp. Is there anyway to link those fields on openbiz without changing its formatting? Or do I have to make a custom js function and link an event there?
 
Thanks!

You may want to do some

You may want to do some debugging. Check BizField

    public function getProperty($propertyName)
    {
        $ret = parent::getProperty($propertyName);
        if ($ret) return $ret;
        if ($propertyName == "Value") return $this->getValue();
        return $this->$propertyName;
    }

You can find the cause from it.

- support

Can you list your metadata

Can you list your metadata relating to this issue?

- support