Create a simple report for customer list. The report should be in landscape with 15 or more columns. In the options tab, there should be 5 checkboxes indicating any 5 columns. If I select those checkboxes then they should not be printed and the columns should be moved. We are talking about moving of columns on the fly. can any one explain me how to create a report...and where should we write code..?
0
Answers
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
If you have applied filter or something then it will show blank space but not if visibility condition is there and still if its showing then theirs a different case altogether.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
This is about the classic client right?
It has no columns, only sections.
They can be hidden using currreport.showoutput onpresection,
but with the requirements you mention this wil take some effort.
IF NOT HideCity THEN
FormatAddr.Customer(CustCity,Customer);
it is not working...
This should thrigger what section is shown.
You'll have to make multiple sections to get the desired result (one for each possible Boolean combination)..
Another way to approach this is to manipulate the CustCity Array after filling it with formataddr.
So, if you want to leave out city, then you should clear this from the array
f.i. clear(CustCity[6]). And after that compress the array.
This way it can probably all be done in one body section, and no showoutput code is needed.
You cannot hide controls/fields (not colums).
You need to have put them on a section that is not hiding, in a way that if one section is showing the other one is hiding. You need to do this with a few more sections. Only one should be showing containing all the data that is needed in that particular combination of Boolean settings.
Please try my other approach too. With arrays you kan fill the controls flexible, and there is probably no need anymore to hide any sections.
In report 119 CustAddr array is used in the second 'column', as you call it, in customer body(7).
The CustAddr Array has 8 Dimensions.
Adjust this to 24 in the C/AL globals properties.
Create ArrayOf8 global with the same text properties, exept give it 8 dimensions.
Now delete the controls that contain
"No.", "VAT Registration No." and AmtSalesLCY from customer body(7)
Select and Copy all the controls in the column and paste them to the right of this column. Paste them again to the right of the pasted column So now you have 3 columns.
Column 1 contains CustAddr[1]..CustAddr[8].
Adjust the arrays in column 2 so that they contain CustAddr[9]..CustAddr[16]
Adjust the arrays in column 3 so that they contain CustAddr[17]..CustAddr[24].
After that write C/AL code in customer/OnAfterGetRecord to move your data through your columns by setting one of three booleans:
//IF NOT HideAddress THEN
// FormatAddr.Customer(CustAddr,Customer);
ShowItInColumn1 := FALSE;
ShowItInColumn2 := TRUE;
ShowItInColumn3 := FALSE;
FormatAddr.Customer(ArrayOf8,Customer);
IF ShowItInColumn1 THEN BEGIN
FOR i := 1 TO 8 DO
CustAddr[i+0] := ArrayOf8[i+0];
END;
IF ShowItInColumn2 THEN BEGIN
FOR i := 1 TO 8 DO
CustAddr[i+8] := ArrayOf8[i+0];
END;
IF ShowItInColumn3 THEN BEGIN
FOR i := 1 TO 8 DO
CustAddr[i+16] := ArrayOf8[i+0];
END;
(+0 because the i in brackets means something in this text editor)
your next reply. I'll try to pinpoint what's wrong.
onaftergetrecord() trigger:
IF NOT Hide THEN
FormatAddr.Customer(CustAddr,Customer);
IF NOT HideName THEN BEGIN
FOR i := 1 TO ARRAYLEN(Customer.Name) DO
CustAddr[3] := Customer.Name;
CustAddr[3] := CustAddr[2];
TName[1] := Customer.FIELDCAPTION(Name);
END;
IF NOT HideAddress THEN BEGIN
FOR i := 1 TO ARRAYLEN(Customer.Address) DO
CustAddr[1] := Customer.Address;
TAddress[1] := Customer.FIELDCAPTION(Address);
END;
IF NOT HideCity THEN BEGIN
FOR i := 1 TO ARRAYLEN(Customer.City) DO
CustAddr[2] := Customer.City;
TCity[1] := Customer.FIELDCAPTION(City);
END;
IF NOT HideCountry THEN BEGIN
FOR i := 1 TO ARRAYLEN(Customer.County) DO
CustAddr[4] := Customer.County;
TCountry[1] := Customer.FIELDCAPTION(County);
END;
IF NOT HideContact THEN BEGIN
FOR i := 1 TO ARRAYLEN(Customer.Contact) DO
CustAddr[5] := Customer.Contact;
TContact[1] := Customer.FIELDCAPTION(Contact);
END;
while running the report I am not able to move the columns properly..
Customer - OnAfterGetRecord()
CLEAR(CustAddr);
CLEAR(CustAddrCaptions);
CustAddr[1] := Name;
CustAddrCaptions[1] := FIELDCAPTION(Name);
CustAddr[2] := Address;
CustAddrCaptions[2] := FIELDCAPTION(Address);
CustAddr[3] := City;
CustAddrCaptions[3] := FIELDCAPTION(City);
CustAddr[4] := "Country/Region Code";
CustAddrCaptions[4] := FIELDCAPTION("Country/Region Code");
CustAddr[5] := Contact;
CustAddrCaptions[5] := FIELDCAPTION(Contact);
IF HideName THEN BEGIN
CLEAR(CustAddr[1]);
CLEAR(CustAddrCaptions[1]);
END;
IF HideAddress THEN BEGIN
CLEAR(CustAddr[2]);
CLEAR(CustAddrCaptions[2]);
END;
IF HideCity THEN BEGIN
CLEAR(CustAddr[3]);
CLEAR(CustAddrCaptions[3]);
END;
IF HideCountry THEN BEGIN
CLEAR(CustAddr[4]);
CLEAR(CustAddrCaptions[4]);
END;
IF HideContact THEN BEGIN
CLEAR(CustAddr[5]);
CLEAR(CustAddrCaptions[5]);
END;
COMPRESSARRAY(CustAddr);
COMPRESSARRAY(CustAddrCaptions);