Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formula problem concatenating 2 strings

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
Hello

What I want to do is concatenate two fields... so I made a formula: {TABLE.MONTH} + "-" + {TABLE.YEAR}. The fields "month" and "year" are integers... What showed up on my report was this "5,00 - 2.002,00". This is obviously not what I wanted to do...

I already tried ROUND({TABLE.MONTH},0) + "-" & ROUND({TABLE.YEAR},0)... I also tried with the CSTR function... THen I tried ROUND and CSTR together but nothing worked...

an idea??? anyone???

thnx in advance

greetz

Mim
 
when you have placed your formula on the grid, right-click on it then go to "field format" or something like this (i use french version :) >>> the icon is a hand holding a sheet of paper)
then go to the number panel, and select the round nuùbers in the list
i think that should work
 
Actually, it's the first thing I checked, but the formula in itself is a string, so I don't have the "Number" panel...
 
so put your 2 fields on the report (put the "delete" option checked) and change the number properties for both fields, then they should be handled correctly in the formula
 
This looked like a great idea (wouldn't have tried it myself), but the result still stays the same... (sigh)... computers can be cruel sometimes... :)

The reason why I want these two fields in one formula is because I want to be able to group on it... When you have to choose a field for grouping, it doesn't allow you to pick two fields, so I did it like this... just telling you that in case you wonder why I do this formula thingie (when it is just so simple to put the two fields on the report, change the formatting and voila! :) )
 
you can't group on 2 fields at the same time but you can make several groups with a certain hierarchy :
group 1 : year
group 2 : month
---details---
group 2 end
group 1 end

then you can place {TABLE.YEAR} and {TABLE.MONTH} in each dedicated group, with the number format. But this will certainly not be the presentation you want, so i suggest it as a temporary solution
Furthermore, I don't think it is possible to group on a formula, only on database fields (??)
 
Well, the way I do it works anyway, just that I have a realy poor lay-out... but I think I found a solution...
I group on both fields seperately (like you suggested) and I place both my fields in the second group... like this:
group 1: year
group 2: month
{month} - {year}
-- details blablabla---
group 2 end
group 1 end

this should work...
I'll give you a sign when I have tried this
 
yep, this worked the way I wanted!!

Thanks for putting me on the way...

greetz a lot

Mim
 
If month and year are integer then the formula {TABLE.MONTH} + "-" + {TABLE.YEAR} should cause an error in formula editor. This is because you are mixing numeric values with string values. If they are integers then your forumala should be something like:

ToText({TABLE.MONTH},"00") + "-" + ToText({TABLE.YEAR},"0000")

Yes you can group on a formula. There are restriction though but in your case you should not have any problem.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top