[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: [sqr-users] defaults for UNSTRING?
- Subject: Re: [sqr-users] defaults for UNSTRING?
- From: don.barclay@srs.gov
- Date: Mon, 10 Oct 2005 09:24:04 -0400
- Delivery-date: Mon, 10 Oct 2005 08:24:45 -0500
- In-reply-to: <20051010091710150.00000002404@JTUCKER2>
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
Hi John,
You can use a replace statement before the unstring to replace [tab][tab]
with [tab][space][tab].
Don
> I'm writing an interface that reads in a rather lengthy tab
> delimited file, and wondered if there was any way to put defaults
> into the Unstring command. For example, if I have John[tab][tab]
> Smith for $First $Middle $Last, I'd love it if $Middle could come
> out as ' ' instead of null.
>
> I wrote a procedure in an SQC that takes care of that stuff as
> follows, but I wanted to see if any of you knew of something simpler
> that I'm missing.
>
> ...
>
> Unstring $File_data by $tab into $First $Middle $Last
>
> Do Clean-String($First, $First)
> Do Clean-String($Middle, $Middle)
> Do Clean-String($Last, $Last)
>
> ...
>
> Begin-Procedure Clean-String($Input, :$Output)
>
> Let $Output = ltrim(rtrim($Input, ' '), ' ')
> If IsNull($Output)
> Let $Output = ' '
> End-If
>
> ...
>
> This should work really well for a fixed length file - Do Clean-
> String(substr($file_data, 1, 30), $First) - so I'll hang onto it
> even if you all have a better suggestion for the tab-delimited file.
> Thanks for any ideas!
>
> -John Tucker
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users