Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reverse entry

Hi Community,

in the below scenario  where if any document has an reversal enrty, i have to show Yes in a column called Is Reversal and No if it do not contain a reversal entry.

   

DDOC  (Document No)RDOC (Reversal Doc)Is reversal
123456Yes
456123Yes
789 No
987 No

I have used the below logic, but it is not showing Yes for all reversal entries. can you let me know where Am going wrong.

Map:

Mapping Load

RDOC,

DDOC

FROM

[Test.QVD]

(qvd);

and in main table

If(match(RDOC,Applymap('Map',DDOC)),'Yes','No') as Is reversal

is not working.

Basically, if RDOC is in DDOC i want it as Yes and no if it is not there.

Kindly help me here.

1 Solution

Accepted Solutions
sunny_talwar

How about this:

Map:

Mapping Load

RDOC,

'Yes' as Flag

FROM

[Test.QVD]

(qvd);

and in main table

ApplyMap('Map', DDOC, 'No') as Is reversal

View solution in original post

10 Replies
sunny_talwar

How about this:

Map:

Mapping Load

RDOC,

'Yes' as Flag

FROM

[Test.QVD]

(qvd);

and in main table

ApplyMap('Map', DDOC, 'No') as Is reversal

Not applicable
Author

what a simple solution !!!

Thanks Mate, not sure why I thought so complicated and written such a big logic. 

Not applicable
Author

Sunny, Where RDOC is null and DDOC has value, it is showing as YES. where it should come as No.

sunny_talwar

Try this:

Map:

Mapping Load

RDOC,

'Yes' as Flag

FROM

[Test.QVD]

(qvd)

Where Len(Trim(RDOC)) > 0;

Not applicable
Author

The issue is, for few Document nos, RDOC is empty even though it is a reversal entry.

But i need to get YES for which RDOC is missing, since it is part of reversal entry. 

Is this achievable, could you plz help.

DDOC  (Document No)RDOC (Reversal Doc)Is reversal
123Yes
456123No
sunny_talwar

I would have thought that this is true now. Can you share a sample where this doesn't work?

Not applicable
Author

Sunny, if the table is as below, IsReversal should be as mentioned.

Only the rows 1 to 4 should be YES.

    

S.No.DDOC RDOCIs Reversal
1123 Yes
2321123Yes
3789987Yes
4987789Yes
5111 No
6222 No
7222 No
8444 No
9555 No
10666 No
sunny_talwar

Try this code:

MappingTable:

Mapping

LOAD RDOC,

  'Yes' as Flag

FROM

Community_221370.xlsx

(ooxml, embedded labels, table is Sheet1);

Table:

LOAD S.No.,

    DDOC,

    RDOC,

    ApplyMap('MappingTable', DDOC, If(Len(Trim(RDOC)) > 0, 'Yes', 'No')) as [IsReversal]

FROM

Community_221370.xlsx

(ooxml, embedded labels, table is Sheet1);

Not applicable
Author

Sunny, you logic is working perfectly.

But, say, in future if we get a entry which has a RDOC filled and doesn't have a reversal entry in the data which we posses, it should come as 'No' which is logically correct. So I have have added one more condition to your condition...

MappingTable1:

LOAD RDOC,

  'Yes' as Flag

FROM

Test.xls

Mapping2:

LOAD DDOC,

  'Yes' as Flag

FROM

Test.xls

MainTable:

ApplyMap('MappingTable1', DDOC,

        If(Len(Trim(RDOC)) > 0 and (ApplyMap('MappingTable2', RDOC))='Yes',

             'Yes', 'No')) as [IsReversal]

S.No.DDOC RDOCIs Reversal
1123 Yes
2321123Yes
3789987Yes
4987789Yes
5456654No

Thanks Sunny.