question regarding ohObjectPropertyValues

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

question regarding ohObjectPropertyValues

kchen
Hi guys,

This may sound stupid to you as I just started using QuantLibXL in excel. I created a range object using ohRange("test", 1), but how can I display the data in the test object? if I do ohObjectPropertyValues("test#0001","Values"), it only returns <VECTOR> instead of the actual value. Am I missing something here? Thank you very much.

K

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: question regarding ohObjectPropertyValues

Eric Ehlers-2
Hello,

Quoting Kaifeng Chen <[hidden email]>:

> Hi guys,
>
> This may sound stupid to you as I just started using QuantLibXL in excel. I
> created a range object using ohRange("test", 1), but how can I display the
> data in the test object? if I do
> ohObjectPropertyValues("test#0001","Values"), it only returns <VECTOR>
> instead of the actual value. Am I missing something here? Thank you very
> much.

You're not missing anything.  ohObjectPropertyValues only supports  
scalar values and simply returns "<VECTOR>" for a vector.  That whole  
"object property" feature is not used very much.

Instead, most specific types have dedicated functions which return  
vector properties where necessary.  For example, spreadsheet  
Workbooks\StandaloneExamples\YieldTermStructures.xls, range  
=[YieldTermStructures.xls]Sheet1!$I$8:$I$28, you can see that function  
qlInterpolatedYieldCurveData is used to display a vector property from  
the object of type InterpolatedYieldCurve constructed in cell  
=[YieldTermStructures.xls]Sheet1!$D$5.

Regards,
Eric

===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: question regarding ohObjectPropertyValues

kchen
Hi Eric,

Thank you for your reply. Is there a quick way of editing the code so as to return the actual values instead of <VECTOR> ?  Where can I find the implementation of ohObjectPropertyValues so I can perhaps cast the boost::any to double ?  I tried to change the return value type from any to double of ohObjectPropertyValues method in file valueobjects.xml, but only caused the addin to crash.  Thank you very much.

Best

Kaifeng
Reply | Threaded
Open this post in threaded view
|

Re: question regarding ohObjectPropertyValues

Eric Ehlers-2
Hi Kaifeng,

Quoting kchen <[hidden email]>:
>
> Hi Eric,
>
> Thank you for your reply. Is there a quick way of editing the code so as to
> return the actual values instead of <VECTOR> ?  Where can I find the
> implementation of ohObjectPropertyValues so I can perhaps cast the
> boost::any to double ?  I tried to change the return value type from any to
> double of ohObjectPropertyValues method in file valueobjects.xml, but only
> caused the addin to crash.  Thank you very much.

The implementation of ohObjectPropertyValues is found in file  
ObjectHandler/ohxl/functions/valueobjects.cpp.  I do not think it  
would be a quick fix to change the behavior of the function.  Its  
return value is already a vector, a list of the values of all of the  
object's properties.  You are concerned with the case where one of  
those values is itself a vector, and to extract that would require a  
bit of redesign.

The functionality of ohObjectPropertyValues() was a very early idea in  
the design of ObjectHandler, which was not really developed because it  
was superseded by other techniques, for example just directly  
accessing the underlying object and calling the specific member  
function that returns the data you need.

Kind Regards,
Eric

===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: question regarding ohObjectPropertyValues

kchen
Hi Eric,

I managed to find a way to get around it. Basically I modify the range object to take vector instead of matrix, when output, I use another function to reshape the output. Thank you for the help.

Kind Regards

Kaifeng


Eric Ehlers-2 wrote
Hi Kaifeng,

Quoting kchen <mr.kaifengchen@gmail.com>:
>
> Hi Eric,
>
> Thank you for your reply. Is there a quick way of editing the code so as to
> return the actual values instead of <VECTOR> ?  Where can I find the
> implementation of ohObjectPropertyValues so I can perhaps cast the
> boost::any to double ?  I tried to change the return value type from any to
> double of ohObjectPropertyValues method in file valueobjects.xml, but only
> caused the addin to crash.  Thank you very much.

The implementation of ohObjectPropertyValues is found in file  
ObjectHandler/ohxl/functions/valueobjects.cpp.  I do not think it  
would be a quick fix to change the behavior of the function.  Its  
return value is already a vector, a list of the values of all of the  
object's properties.  You are concerned with the case where one of  
those values is itself a vector, and to extract that would require a  
bit of redesign.

The functionality of ohObjectPropertyValues() was a very early idea in  
the design of ObjectHandler, which was not really developed because it  
was superseded by other techniques, for example just directly  
accessing the underlying object and calling the specific member  
function that returns the data you need.

Kind Regards,
Eric

===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users