Simplicty and flexibility!


Developer Tips! FixedWidth() and StringTo() in practice ...

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

Developer Tips! FixedWidth() and StringTo() in practice ...

Download Sample

Thank you for giving us such a brilliant opportunity to show of some of the new and sadly not so well known functions in DataEase 8.

In this sample we will use the following to functions:
FixedWidth()
StringTo()

FixedWidth() basically return a fixed string of n length where you can choose if the value should be left, center or right oriented.
StringTo() basically return the value up to but not including a search that can be a character or a string, so in this sample we will use StringTo(Value," ,")="" which="" will="" return="" 19342="" from="" the="" number="" 19342,44.=""


Here we see the data we want to export and the DQL that will export them to the right. 

In this DQL we have taken the problem a little further and also rounded the decimals up and down before stripping the decimals.

The "trick" to do that in DE is simply to add 0.5 and then floor the resulting value i.e.strip the decimals away. In this case we didn't really need to use floor as we were going to strip them anyway with StringTo() but it was a nice opportunity to show how to do this too... ;-)

StringTo() is complimented by StringFrom() and StringBetween() so you can basically strip and get whatever you want from inside a string.

Another complimentary set is of course MemoStringTo(), MemoStringFrom() and MemoStringBetween() 


Written by DataEase 13/02/15 at 18:56:43 Dataease [{8}]FIVE