How to Achieve this Logic?
Moderators: chulett, rschirm, roy
How to Achieve this Logic?
Hi All,
I have two tables one is code and another is Customer.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
I have to write a logic if code starts with 1 the populate corresponding Address column based on CustID
strucked with the second logic
else if code starts with 2 then look back the address column which has come for code starts with 1 using CustID(i.e laknar).
Can anyone advice this logic .
I have two tables one is code and another is Customer.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
I have to write a logic if code starts with 1 the populate corresponding Address column based on CustID
strucked with the second logic
else if code starts with 2 then look back the address column which has come for code starts with 1 using CustID(i.e laknar).
Can anyone advice this logic .
You can use a stage variable to capture previous addresses, so you can have something like:
if CustID[1,1] = '1' then DSLink1.Address else StageVar1
simply populate your output column with StageVar1
This assumes data is sorted in the correct order of processing.
if CustID[1,1] = '1' then DSLink1.Address else StageVar1
simply populate your output column with StageVar1
This assumes data is sorted in the correct order of processing.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
Hi,
i believe the stage variable will only hold current processing data and it will not go back to previous data.
loop will run when in sequential mode.
f CustID[1,1] = '1' then we have to go for CustID[1,1] = '2' address values.
if not correct please correct me.
or shall i have corresponding code 2 values lookup to link the address.
i believe the stage variable will only hold current processing data and it will not go back to previous data.
loop will run when in sequential mode.
f CustID[1,1] = '1' then we have to go for CustID[1,1] = '2' address values.
if not correct please correct me.
or shall i have corresponding code 2 values lookup to link the address.
Dont worry about variables beginning with 2, the logic reads:
StageVar1 = if CustID[1,1] = '1' then DSLink1.Address else StageVar1
StageVar1 will be persistent so you can access previous values.
StageVar1 = if CustID[1,1] = '1' then DSLink1.Address else StageVar1
StageVar1 will be persistent so you can access previous values.
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
-
- Participant
- Posts: 597
- Joined: Fri Apr 29, 2005 6:19 am
- Location: Singapore
It depends on your requirements. If you want to process the records in the order it comes, don't do sort. If you could explain with more example of codes, it would be better.
code cust
12 A
31 B
22 C
21 D
So what should be the ouput, if the input is like shown above..
code cust
12 A
31 B
22 C
21 D
So what should be the ouput, if the input is like shown above..
Kandy
_________________
Try and Try again…You will succeed atlast!!
_________________
Try and Try again…You will succeed atlast!!
-
- Participant
- Posts: 597
- Joined: Fri Apr 29, 2005 6:19 am
- Location: Singapore
I have two tables one is code and another is Customer.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
I have two tables one is code and another is Customer.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
I have two tables one is code and another is Customer.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
Number Code CustID
123456 12 123
123456 22 234
CustID Address
123 laknar
234 standard
if code starts with 2 then corresponding address from customer table.
if code starts with 1 then address column of code[1,1]='2'.
this is my logic.please advice me.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The sort order is maintained as long as you don't repartition or resort the data.
I suspect that you may not have managed your partitioning strategy correctly.
A simple test... use a single node configuration file... if your results are correct running on a single node, then you have a partitioning logic flaw. If your results remain incorrect, then you have a transformation logic flaw.
Mike
I suspect that you may not have managed your partitioning strategy correctly.
A simple test... use a single node configuration file... if your results are correct running on a single node, then you have a partitioning logic flaw. If your results remain incorrect, then you have a transformation logic flaw.
Mike