Problems-Hints and a question for Employee Portal

ArhontisArhontis Member Posts: 667
edited 2007-01-25 in Navision e-Commerce
Hello everyone...

I had some problems with EP and found some solutions that might come handy in the future...

1) I wanted to be able to filter Vendor Ledger Entries depending on userid, but could not do it... So I added a parameter pUserID (text50) to the FilterRecord function in the EP Decode XML codeunit, added some code at the end of that function like:
          // Add the correct String to the End of the Filter

          //my code start
          IF (TableNo=25) THEN BEGIN//check if table is vendor ledger entry
              IF pUserID='ITISME' THEN//building the filter by checking the
                vMyFilter := 'some test'
              ELSE
                vMyFilter := 'another test';
              SupportFunctions.GetFieldCaption(TableNo,50006,FieldName);
              SupportFunctions.BuildFilterString(FilterString,FilterType::Filter,FieldName,vMyFilter);
            END;
          END;
          //my code end
         SupportFunctions.BuildFilterString(FilterString,FilterType::AddEnd,'','');
(my custom filed is the 50006 at the GetFieldCaption above)
I also modified the three calls of that function in the EP Read Data codeunit like:
DecodeXML.FilterRecord(XMLDocLineFilters,TableNo,LineRecordRef,UserID);//the UserID ad the end

2) I wanted to be able to use filters like CM or CW in the connection header/Line fileds in the "Line field Default Value" but no success... So I just entered some code in the CreateFilterHeadLine function in the EPEncode XML codeunit (almost at the end) like:
            END ELSE BEGIN
              IF AddElement(
                XMLCurrNode,'FIELD',
                FormatFunctions.IntegerToText(EPConnHeadLine."Line Field No."),DocNameSpace,XMLNewChild) > 0
              THEN
                EXIT;
              //my code starts here
              IF EPConnHeadLine."Line Field Default Value"='CM' THEN
                vTempFilter := FORMAT(CALCDATE('-1M',TODAY))+'..'+FORMAT(TODAY)
              ELSE
                IF EPConnHeadLine."Line Field Default Value"='CW' THEN
                  vTempFilter := FORMAT(CALCDATE('-1W',TODAY))+'..'+FORMAT(TODAY)
                ELSE
                  vTempFilter := EPConnHeadLine."Line Field Default Value";
              //my code ends here

              IF AddElement(
                XMLCurrNode,'VALUE',
                //EPConnHeadLine."Line Field Default Value",//comment this line
                vTempFilter,//modified line by using the vTempFilter
                DocNameSpace,XMLNewChild) > 0
              THEN
                EXIT;
            END;
          END;
        XMLCurrNode := XMLCurrNode.parentNode; // </FILTER>
      UNTIL EPConnHeadLine.NEXT = 0;
    END;

  XMLCurrNode := XMLCurrNode.parentNode; // </FILTERGROUP>
END;
(used a text var to build my text... )

Of course it is a little hardcoded, ans someone could always make checks if the field is a date field and generate whichever date filter wants, but I didn't have much time... needed only the CM and CW option to use...

And a question... has anyone made multiple paging with a Header/Line group? I have enormous data and cannot have a detail of thousand lines over the net... Currently I have limited the recs with the CM and CW to show only the last active recs... and used a report to show all of them (in paging of course)

I used Nav4 SP2 for the above implementations... and the SP3 is not that different... only 2 or 3 changes in EP objects have been made...
Sign In or Register to comment.