I want to use SAVEASHTML in a loop for batchprocessing order confirmations. When I do that, the SAVETOHTML method asks if I want to rename the record.
Is there a solution for using SAVEASHTML in a loop?
Best Regards / HÃ¥kan Svensson
*This post is locked for comments
Glad to help :)
Thanks! :-)
Pass Testtable record as a parameter to RunLine Function(p_rec)
Change all l_rec to p_rec in that function including Code in SaveasHTML path.
write RunLine(Rec); in RunLine push trigger
write below code in RunAll function
l_rec := Rec;
IF l_rec.FINDSET THEN REPEAT
RunLine(l_rec);
UNTIL l_rec.NEXT = 0;
Hi
This is what it looks like. Two methods in a form. RunLine woeks fine, but when calling it from RunAll I am asked if I want to rename the record(Rec). Further below see also a txt-fob (dont know how to attach) for the whole test scenario.
*******RunAll()*****************************************************************
IF FINDFIRST THEN REPEAT
RunLine;
UNTIL NEXT = 0;
*******RunLine()***************************************************************
l_rec := Rec;
l_rec.SETRECFILTER;
l_report.SETTABLEVIEW(l_rec);
l_report.SAVEASHTML('c:\testfolder\test' + FORMAT(Code) + '.HTM');
*********************************************************************************
*********************************************************************************
**************************THE FOB ********************************************
DO LIKE THIS:
Edit the file path found in code in the form.
Take a quich look at the minimal code.
Run the form.
Press "Fill Table" to get test data.
Press "Run Line" to see that it works fine.
Press "Run All" and you will be asked whether you want to rename the record.
*********************************************************************************
*********************************************************************************
OBJECT Table 66666 TestTable
{
OBJECT-PROPERTIES
{
Date=13-04-25;
Time=11:16:32;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
FIELDS
{
{ 1 ; ;Code ;Integer }
{ 2 ; ;Description ;Text30 }
}
KEYS
{
{ ;Code ;Clustered=Yes }
}
FIELDGROUPS
{
}
CODE
{
PROCEDURE FillTable@1000000000();
BEGIN
DELETEALL;
Code := 1;
Description := 'Dummytext';
INSERT;
Code := 2;
INSERT;
Code := 3;
INSERT;
END;
BEGIN
END.
}
}
OBJECT Form 66666 TestForm
{
OBJECT-PROPERTIES
{
Date=13-04-25;
Time=11:20:48;
Modified=Yes;
Version List=;
}
PROPERTIES
{
Width=9790;
Height=6710;
TableBoxID=1000000000;
SourceTable=Table66666;
}
CONTROLS
{
{ 1000000000;TableBox;220 ;220 ;9350 ;5500 ;HorzGlue=Both;
VertGlue=Both }
{ 1000000001;TextBox;0 ;0 ;1700 ;0 ;ParentControl=1000000000;
InColumn=Yes;
SourceExpr=Code }
{ 1000000002;Label ;0 ;0 ;0 ;0 ;ParentControl=1000000001;
InColumnHeading=Yes }
{ 1000000003;TextBox;0 ;0 ;4400 ;0 ;HorzGlue=Both;
ParentControl=1000000000;
InColumn=Yes;
SourceExpr=Description }
{ 1000000004;Label ;0 ;0 ;0 ;0 ;ParentControl=1000000003;
InColumnHeading=Yes }
{ 1000000005;CommandButton;2530;5940;2200;550;
CaptionML=SVE=Fill Table;
OnPush=BEGIN
FillTable;
END;
}
{ 1000000006;CommandButton;4950;5940;2200;550;
CaptionML=SVE=Run Line;
OnPush=BEGIN
RunLine;
END;
}
{ 1000000007;CommandButton;7370;5940;2200;550;
CaptionML=SVE=Run All;
OnPush=BEGIN
RunAll;
END;
}
}
CODE
{
PROCEDURE RunAll@1000000002();
BEGIN
IF FINDFIRST THEN REPEAT
RunLine;
UNTIL NEXT = 0;
END;
PROCEDURE RunLine@1000000003();
VAR
l_report@1000000000 : Report 66666;
l_rec@1000000001 : Record 66666;
BEGIN
//CONFIRMS ARE ONLY TO MAKE IT POSSIBLE TO BREAK PROCESS
l_rec := Rec;
l_rec.SETRECFILTER;
l_report.SETTABLEVIEW(l_rec);
IF NOT CONFIRM('Before',TRUE) THEN ERROR('');
l_report.SAVEASHTML('c:\qqq\test' + FORMAT(Code) + '.HTM');
IF NOT CONFIRM('After',TRUE) THEN ERROR('');
END;
BEGIN
END.
}
}
OBJECT Report 66666 TestReport
{
OBJECT-PROPERTIES
{
Date=13-04-24;
Time=21:40:42;
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table66666;
DataItemTableView=SORTING(Code);
ReqFilterFields=Code;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
PrintOnEveryPage=Yes;
SectionWidth=18150;
SectionHeight=1692;
}
CONTROLS
{
{ 1000000001;Label ;0 ;0 ;7500 ;423 ;FontSize=8;
FontBold=Yes;
CaptionML=SVE=TestTabell }
{ 1000000002;TextBox;15000;0 ;3150 ;423 ;HorzAlign=Right;
SourceExpr=FORMAT(TODAY,0,4) }
{ 1000000003;TextBox;0 ;423 ;7500 ;423 ;SourceExpr=COMPANYNAME }
{ 1000000004;TextBox;17700;423 ;450 ;423 ;CaptionML=SVE=Sida;
SourceExpr=CurrReport.PAGENO }
{ 1000000005;Label ;16950;423 ;750 ;423 ;ParentControl=1000000004 }
{ 1000000006;TextBox;15900;846 ;2250 ;423 ;HorzAlign=Right;
SourceExpr=USERID }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=18150;
SectionHeight=1269;
}
CONTROLS
{
{ 1000000008;TextBox;3150 ;0 ;1050 ;423 ;HorzAlign=Left;
SourceExpr=Code }
{ 1000000009;Label ;0 ;0 ;3000 ;423 ;ParentControl=1000000008 }
{ 1000000011;TextBox;3150 ;423 ;4500 ;423 ;HorzAlign=Left;
SourceExpr=Description }
{ 1000000012;Label ;0 ;423 ;3000 ;423 ;ParentControl=1000000011 }
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=9020;
Height=3410;
}
CONTROLS
{
}
}
REQUESTPAGE
{
PROPERTIES
{
}
CONTROLS
{
}
}
CODE
{
BEGIN
END.
}
RDLDATA
{
}
}
Can you show us the code and where did you write the code in report?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156