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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datafields in one row

Status
Not open for further replies.

mimiotoko

MIS
Apr 10, 2003
17
DE
Hello,
it is necessary in my ticket programm that about 10 datafields are placed in 1 row. It is grouped by the attribute LINE and the SEATS have to appear in the same row. Like this:
Line 1 Seat 5, 6, 7, 8 ...
Line 2 Seat 5, 6
Line 3 Seat 12, 13...

I tried it with three formulars. First in the Group Header:

WhilePrintingRecords;
StringVar chain :=";
NumberVar ChCnt :=1


Next in the details:

WhilePrintingRecords;
StrngVar Item := {temp.Buchung};
StringVar chain;
NumberVar ChCnt;
if ChCnt = 1
then (Chcnt :=2; chain := Item)
else
if Length(chain) + Length(Item) > 254
then chain := chain
else
chain := chain + ', ' + Item


Last in the Group Footer:

WhilePrintingRecords;
StringVar chain

Thats all. It works, but looks like this:

Line 1 Seat 5,00
Seat 5,00, 6,00
Seat 5,00, 6,00, 7,00
Seat 5,00, 6,00, 7,00, 8,00 ...
Line 2 Seat 5,00
Seat 5,00, 6,00
Line 3 Seat 12,00
Seat 12,00, 13,00...

Now I have 3 problems. I have to transform the currency in a number. Only one line of details must be behind the "Line x", and at last only 10 numbers (Seats) are allowed in one row.

Who can help me?
thx
Rainer

 
It appears that you're displaying in the detail, not the group footer as the formula appears correct.

Since {temp.Buchung} is already a string, it appears to have formatting of decimals embedded.

You can change it with:

StrngVar Item := totext(val({temp.Buchung}),0,"");

So what is the intent if there are more than 10 seats in a row, show a second line, or???

-k
 
yes, the next 10 seats must appear in the next row, and so on...
 
Great! In the group-footer it works.
When I change the code into:
StrngVar Item := totext(val({temp.Buchung}),0,"");
then I got the massage:
Here is a string needed! (Hier wird eine Zeichenfolge benötigt!)
 
sorry, but i get the same error:
Here is a string needed! (Hier wird eine Zeichenfolge benötigt!)
 
Is this a version thing, I notice that you use strngvar not stringvar?

I think that this error means that the data is not always just a numeric value, which is odd if it was working with your previous code.

Lisa's suggestion may resolve, otherwise you might check for the validity of the data using the Isnumeric function, as in:

StrngVar Item := "";
if isnumeric({temp.Buchung}) then
Item := totext(val({temp.Buchung}),0,"")

-k
 
first I tried strngvar, but that doesn't work with R 8.5.
I changed my sourcecode no to:

WhilePrintingRecords;
StringVar chain;
NumberVar ChCnt;
StringVar Item := "";
if isnumeric({temp.Buchung}) then
Item := totext(val({temp.Buchung}),0,"");

if ChCnt = 1
then (Chcnt :=2; chain := Item)
else
if Length(chain) + Length(Item) > 254
then chain := chain
else
chain := chain + ', ' + Item

But the same error does appear. The cursor is, after closing the popup-window, between "(" and "{" after "isnumeric"
Sorry because of my big problem ;-(
 
Are you sure the datatype of temp.Buchung is a string? You can right click in the explorer and "show field type" to see what Crystal thinks it is.

Lisa
 
I think I'm starting to get it, the code you'd demostrated before wasn't functioning code.

There may be some problems in translation here, because you state that:

"Great! In the group-footer it works.
When I change the code into:
StrngVar Item := totext(val({temp.Buchung}),0,"");
then I got the massage:
Here is a string needed! (Hier wird eine Zeichenfolge benötigt!)"

How can it work and give an error?

Please post all of your current code and the data types of the fields involved.

-k
 
StrngVar Item := totext(val({temp.Buchung}),0,"");


You have left out the "i" in string...should be

StringVar Item := totext(val({temp.Buchung}),0,"");


Jim Broadbent
 
all right, here is the current, complete code:

in Group header:
WhilePrintingRecords;
StringVar chain :=";
NumberVar ChCnt :=1

in details:
WhilePrintingRecords;
StrngVar Item := {temp_Buchung.Temp_Sitz};
StringVar chain;
NumberVar ChCnt;
if ChCnt = 1
then (Chcnt :=2; chain := Item)
else
if Length(chain) + Length(Item) > 254
then chain := chain
else
chain := chain + ', ' + Item

in Group Footer:
WhilePrintingRecords;
StringVar chain


the field of the database (temp_Buchung.Temp_Sitz) is a number.

in my report the group header and the details are disabled. so it looks to me like this:

Line: 0 Sitz: 5,00, 6,00, 7,00, ...
Line: 1 Sitz: 4,00, 5,00
Line: 2 Sitz: 6,00, 7,00, 8,00, 9,00 ...
Line: 3 Sitz: 12,00 ...

this is completely correct. Only the format of the numbers must be changed in an number. so I tried your code-changes like this:

StringVar Item := "";
if isnumeric({temp_Buchung.Temp_Sitz}) then
Item := totext(val({temp_Buchung.Temp_Sitz}),0,"");

the error is: string expected (cursor's behind isnumeric after closing the Popup)



 
I've found it by myself.

StringVar Item:= ToText(round({Temp_Buchung.Temp_Sitz}),0);

Thats all. And it works!
Thx you all for helping!!

Now my only problem is, that after 10 seats a crlf has to come. But i hope, that this problem isn't as difficult ;-)

Best regards Rainer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top