NickO Posted October 22, 2007 Report Posted October 22, 2007 Hi Guys, been scratching my head on this one for a while....what do I need to add to _sTagToUse in the TrnGetTable function to get example 2 working the same as example 1 ? Thanks in advance..Nick Example 1 STRING _sDateToUse; STRING _sDateYesterday = ( (TimeToStr(( DateAdd(StrToDate(Date()),2)) - 86400,2))); STRING _sDateToday = ( (TimeToStr(( DateAdd(StrToDate(Date()),2)) - 0,2))); string _sTagToUse; _sDateToUse = _sDateYesterday; TrnGetTable("InletFlow_s",StrToDate(_sDateToUse) + StrToTime("01:00"),1,3600,InletFlowTable1[0],0);//this works Example 2 - doesnt work STRING _sDateToUse; STRING _sDateYesterday = ( (TimeToStr(( DateAdd(StrToDate(Date()),2)) - 86400,2))); STRING _sDateToday = ( (TimeToStr(( DateAdd(StrToDate(Date()),2)) - 0,2))); string _sTagToUse; _sDateToUse = _sDateYesterday; _sTagToUse = "InletFlow_s"; TrnGetTable(_sTagToUse,StrToDate(_sDateToUse) + StrToTime("01:00"),1,3600,InletFlowTable1[0],0);// Quote
Nathan Posted October 23, 2007 Report Posted October 23, 2007 (edited) I don't know anything about Citect. It looks like your declaration of _sTagToUse needs to be capitalized. Like: STRING _sTagToUse = "InletFlow_s"; Your first example defines that variable, but never uses it. I find it odd that a lower case keyword would not work AND not throw an error, but who knows. Everything else looks like it should work the same in both cases. Also, you might be able to simplify your code by not converting back and forth between strings so much. Some of that may have to do with how limited "dates" are versus "times". Edited October 23, 2007 by Nathan Quote
NickO Posted October 23, 2007 Author Report Posted October 23, 2007 Thanks Sparky, yes string should be STRING, that was me being quick on my post, apologies. Any other input would be appreciated. Cheers Nick Quote
Nathan Posted October 24, 2007 Report Posted October 24, 2007 Sparky? That must be some kind of forum rank based on posts or something. My name is Nathan. I would call Citect at this point. It makes absolutely no sense to me that the first case would work and the second wouldn't. Have you tried changing the first to the second then back again to the first (testing for non-script, bad copies of objects/windows/etc)? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.