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

Logic help needed

I have below data set.

 

IDSubIDActual
11100
12200
13250
22300
23400
33500
34600

Output needed (I want to calculate it in front end only)

 

IDValue
10
2200
3

400

Logic: For ID 2, I want to see previous ID & subid should be equal to current id

          example, For ID 2, I will see the previous ID 1 and Pick subid =2 value

20 Replies
Not applicable
Author

Yes, Input will be like below

Step

1

2

3

4

5

based on step selection, our calculation should work. I think this is possible only from front end.

sunny_talwar

Try this:

Table:

LOAD *,

  AutoNumber(ID&SubID) as Key;

LOAD * INLINE [

    ID, SubID, Actual

    1, 1, 100

    1, 2, 200

    1, 3, 250

    2, 2, 300

    2, 3, 400

    3, 3, 500

    3, 4, 600

];

Left Join (Table)

LOAD *

Where ID = SubID;

LOAD ID + IterNo() as ID,

  SubID,

  Actual as Prev_Actual,

  IterNo() as Step

Resident Table

While IterNo() <= 5;

When Step = 2

Capture.PNG

When Step = 1

Capture.PNG

Not applicable
Author

stalwar1‌ thanks a lot, but issue with me is, ID is actually in characters(iterno will not work i guess), I would not be able to share the data due to which I prepared this data. Sorry for the inconvenience.

sunny_talwar

Can you share how your ID looks like?

Not applicable
Author

It's Ab12ef, abce12, cd12ce etc.. it's random alphanumeric string in which there is no pattern

sunny_talwar

So then what is Step1 and Step2? I guess you will have to provide a better sample for us to look at, this is something I can't really comment about without looking at

Not applicable
Author

See this sample Data

 

IDSubIDActual
AB12CDAB12CD100
AB12CDTD123C200
AB12CDPC12KT250
TD123CTD123C300
TD123CPC12KT400
PC12KTPC12KT500
PC12KTKC123T600

for Step 1, Go to previous ID(1 step),  check subid which is equal to below(1 step) id

 

IDValue
AB12CD0
TD123C200
PC12KT400

for step 2, Go to previous ID(2 step),  check subid which is equal to below (2 step) id

 

IDValue
AB12CD0
TD123C0
PC12KT250

Logic is the same which I have explained in OP.

Not applicable
Author

please help stalwar1‌, swuehlgwassenaar

Not applicable
Author

any update?

sunny_talwar

Responded to your new thread:

Re: Previous value logic