You can't reference {DATEMI} in the code because you don't have the value yet. Retrieval code's purpose is to load the code from disk (or wherever) into the field value.
Also, If the conversion is as simply as YYYYMMDD -> +$H, you can skip the overhead of the routine call and just use $Zdateh(...,8).
Here is an example:
s {DATEMI}=$Zdateh($Piece(^glo({L1},"^",10),8)In this example the DATEMI data is stored at $Piece(^glo({L1},"^",10).Another option for this would be to use a user-defined datatype with LogicalToStorage and StorageToLogical methods. This will make it easier for the table to be read/write.
Hope this helps.
-dave
Filipe Niero Felisbino wrote:
Hello, I've created a class in cach� that is using the storage CacheSQLStorage to get data from a previosly created global. This global have a piece that uses the date format yyyymmdd (20031201) and I need to convert this value to a Date value using the option of retrieval code.
I tried put the following code: S DATA={DATEMI} D ^%SSTDT Q DATA
The ^%SSTDT is a rotine that converts the string into date. The code bellow is not working, when I try to execute a SQL a error with SQLCODE-400 ocurrs. How is the way to use the "retrieval code" from cach�?
Thanks
