Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Partner
Partner

Transfer 50% of the value from one side to the other

Hello friends, thanks for your time.

I'm having an problem.

Capturar.JPG

 

I need to move 50% of the value that every CC have( Column CC ORIGEM) to the corresponding one CR (Column CC DESTINO).  What's your advice?

 

Again, Thanks 

7 Replies
Nadi_Clarke
New Contributor II

Re: Transfer 50% of the value from one side to the other

If I understand correctly then you should do

 

mid(CCORIGEM,1,5)& mid(CCDESTINO,6, len(CCDESTINO)-6)

or

replace(CCDESTINO,'230CR','224CC')

Partner
Partner

Re: Transfer 50% of the value from one side to the other

Maybe my question isnt complete.

I have another table with the field CC  ( that Match with the both columns CCORIGEM and CCDESTINO) with the amount.

Imagine that example,

The 224CC9000 has the ammount of 500, what I need is that half of that amount (225) be transferred to 230CR2000 and so on. 

 Thanks by your time

 

Nadi_Clarke
New Contributor II

Re: Transfer 50% of the value from one side to the other

Sorry, I still dont understand what you want.

Can you make me example.

 like column(1) + column(2) = result

Support
Support

Re: Transfer 50% of the value from one side to the other

Did you get things sorted out, or are you still trying to find a solution?  If you did come up with something, please post that solution, so others on the community can learn from that.  You can write that up and then use the Accept as Solution button to mark it as what you did etc.  

Regards,
Brett

To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
Partner
Partner

Re: Transfer 50% of the value from one side to the other

I'm still struggling to find an way to do this. 

Basically, i have the principal table that have all the information and i want to cross that main table with that little table with the CC_origem and the CC_destino.

I can't figure out waht to do. 

Support
Support

Re: Transfer 50% of the value from one side to the other

It will likely help if you can attach a sample app or a subset of what you have etc., as sometimes folks need to be able to see the data model and stuff in order to figure out what the right answer is...

Regards,
Brett

To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
asinha1991
Contributor III

Re: Transfer 50% of the value from one side to the other

if I understand correct then you have a field lets say A which has 'n' values and you want to create a new table with B and C fields, and each of them will have n/2 randomly allocated values? I don't know why you want to do this but I can think of a way

Table1:

Load A,addfield,rowNo() as RNO from Table 1;

 

Table 2:

Load additionalfield, 

if (mod(RNO,2)=0,A) as B,

if(not mod(RNO,2)=0,A) as C,

Resident Table1;

Drop table Table1;

so I distributed A 50-50 in B and C