Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Logical Error

Hello Everyone,

I am facing an issue while creating a logic. Require your help

Data:

A
1
2
2
2
2
3
3
3
3
4
2
2
3
3
4

4

Output:

 

  

AOutput
11
22_1
22_2
22_3
22_4
33_2_4_1
33_2_4_2
33_2_4_3
33_2_4_4
44_3_2_4_4_1
22_5
22_6
33_2_6_1
33_2_6_2
44_3_2_6_2_1
44_3_2_6_2_2

The logic behind the output is very easy.

Thanking you all in anticipation

Regards

KP

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

See attached and let me know if this helps

logic error.JPG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

14 Replies
eduardo_sommer
Partner - Specialist
Partner - Specialist

Hi,

If you explain the logic behind the output (that you say it's easy), it would be easier to help. I couldn't find the pattern.

Eduardo

vinieme12
Champion III
Champion III

Hi ,

Can you explain the logic so people don't spend time guessing!

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
awhitfield
Partner - Champion
Partner - Champion

Hi,

The logic behind the output is very easy.

BUT YOU NEED TO TELL US WHAT IT IS!

Crystal ball is not working today!

Andy

Anonymous
Not applicable
Author

Sorry Guys (@awhitfield, @vinieme12, @eduardo.sommer ) for that lame line; 'Logic behind it is very easy'.

Please see the below image, it is very informative and explains the logic .

Tree.JPG

The Order of input data will not change. This data would come from SAP

vinieme12
Champion III
Champion III

This Tree diagram is not informative nor is it explaining the derivation of the node elements!

Can you explain how each item is evaluated?

for example:  4_3_2_4_4_1  and 4_3_2_6_2_2 ??

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

See attached and let me know if this helps

logic error.JPG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
antoniotiman
Master III
Master III

Hi,

Temp:
LOAD A,Autonumber(RowNo(),A) As NR,AutoNumber(A) as Level,RowNo() As Rowno
Inline [
A
1
2
2
2
2
3
3
3
3
4
2
2
3
3
4
4
]
;

Load Rowno,A,If(Level > 2,NewA&AutoNumber(RowNo(),NewA),NewA) as NewA;
LOAD A,Level,Rowno,
If(Level = 1,A,
If(Level = 2,A&'_'&NR,
If(Peek(A) <> A,A&'_'&Peek(NewA)&'_',Left(Peek(NewA),Len(Peek(NewA))-1)))) as NewA
Resident Temp;
Drop Table Temp;

Regards,

Antonio

vinieme12
Champion III
Champion III

Nice ; but I'd generally avoid Preceding load

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thanks vinieme12  for your quick reply,

      actually i was able to achieve the same ouput with a similar type of code but the problem here is its not a dynamic code, what if someday 5 is also added to the tree