Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ElroyJetson on August 31, 2017, 02:16:19 PM

Title: Getting data from SDT structure
Post by: ElroyJetson on August 31, 2017, 02:16:19 PM
All,

 I'm trying to create a custom datecode, with data pulled from the SDT0 structure. I have to assign the decade, the year, and the month a letter code, add some time and shift info, then put all of that into a string and stream it out to a printer. I'm having trouble figuring out how to isolate the decade number from the year.

Any hints greatly appreciated.......
Title: Re: Getting data from SDT structure
Post by: ADC Product Engineer on August 31, 2017, 02:49:13 PM
Look at the string scripting.  Help topic DMD0168.  Possibly FMTINT() to extract the decade.  Or use STRSUB to get the decade.
Title: Re: Getting data from SDT structure
Post by: BobO on August 31, 2017, 03:20:45 PM
All,

 I'm trying to create a custom datecode, with data pulled from the SDT0 structure. I have to assign the decade, the year, and the month a letter code, add some time and shift info, then put all of that into a string and stream it out to a printer. I'm having trouble figuring out how to isolate the decade number from the year.

Any hints greatly appreciated.......

(Year/10)%10 should give you the decade digit
Title: Re: Getting data from SDT structure
Post by: ElroyJetson on September 01, 2017, 09:28:50 AM
Thanks, BobO!
Is there a way to delete the white space between strings when putting them into other strings? I am using strprint to put multiple short strings into a long string, but I cannot remove the white space between them....
Title: Re: Getting data from SDT structure
Post by: BobO on September 01, 2017, 09:33:08 AM
Thanks, BobO!
Is there a way to delete the white space between strings when putting them into other strings? I am using strprint to put multiple short strings into a long string, but I cannot remove the white space between them....

Uncheck this...
Title: Re: Getting data from SDT structure
Post by: ElroyJetson on September 01, 2017, 09:44:40 AM
That was not checked. Apparently strings aren't treated the same as numeric data. If you use numeric data, a space between elements does not go into the string, but string elements do.
Title: Re: Getting data from SDT structure
Post by: BobO on September 01, 2017, 09:54:27 AM
That was not checked. Apparently strings aren't treated the same as numeric data. If you use numeric data, a space between elements does not go into the string, but string elements do.

I'm not seeing that. Is the space in the source string?
Title: Re: Getting data from SDT structure
Post by: ElroyJetson on September 01, 2017, 09:59:30 AM
No, its not.
I have placed SS0 SS1 SS2 SS3 SS4 SS5 SS6 into SL1. Space between them or the STRPRINT wont accept them. When I view SL0, it appears there is a space between each short string.
Title: Re: Getting data from SDT structure
Post by: ElroyJetson on September 01, 2017, 10:07:27 AM
Looks like this in Data View
Title: Re: Getting data from SDT structure
Post by: ElroyJetson on September 01, 2017, 10:12:31 AM
Sorry........Clearly there are "Space separator inserted" on the SS.......... :-\

I should probably go home now........ ::)
Title: Re: Getting data from SDT structure
Post by: BobO on September 01, 2017, 10:22:02 AM
Sorry........Clearly there are "Space separator inserted" on the SS.......... :-\

I should probably go home now........ ::)

Happens to us all.
Title: Re: Getting data from SDT structure
Post by: franji1 on September 01, 2017, 10:37:18 AM
In Data View, there is another display format for strings called Quoted, where you can see any leading/trailing white space that doesn't show up when viewed in ASCII format.  The other benefit is that it can show you any control characters in quoted $-escape format (e.g. "$0D$0A" for CR/LF).  ASCII would just show two dots (since you can't display a CR or LF).

So, I bet your SS strings in Data View in Quoted format would have looked like
"B "
"H "
"I "
"1 "

To change a Data View entry's display format, look at the drop-down combo box in the Data View's toolbar.