Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi.
Hi.
how do i divide a value in one variable and assign to 2 other given variables 50% each or if possible divide v1 randomly and assign it to v2 and v3.
Example 1: v1 is the variable to divide into v2 and v3.
v1: 30
v2: 25
v3: 20
result:
v2: 40
v3: 35
Example 2: v1 is the variable to divide into v2 and v3.
v1: 21
v2: 10
v3: 20
result:
v2: 20
v3: 31
Example 3 Randomly: v1 is the variable to divide into v2 and v3.
v1: 21
v2: 10
v3: 20
result:
v2: 25
v3: 36
Hello,
Here are some options that you can use in Data load editor:
//Use case scenario 1:
Let v1 = 30;
Let v2 = 25;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let v2 = $(v1)/2 + $(v2);
Let v3 = $(v1)/2 + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
//Use case scenario 2:
Let v1 = 21;
Let v2 = 10;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let v2 = Floor($(v1)/2) + $(v2);
Let v3 = $(v1) - Floor($(v1)/2) + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
//Use case scenario 3:
Let v1 = 21;
Let v2 = 10;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let randomNumber = ROUND((rand()*1),0.1);
Trace Random number: $(randomNumber);
Let v2 = Floor($(v1)*randomNumber) + $(v2);
Let v3 = $(v1) - Floor($(v1)*randomNumber) + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members.
Hello,
Here are some options that you can use in Data load editor:
//Use case scenario 1:
Let v1 = 30;
Let v2 = 25;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let v2 = $(v1)/2 + $(v2);
Let v3 = $(v1)/2 + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
//Use case scenario 2:
Let v1 = 21;
Let v2 = 10;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let v2 = Floor($(v1)/2) + $(v2);
Let v3 = $(v1) - Floor($(v1)/2) + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
//Use case scenario 3:
Let v1 = 21;
Let v2 = 10;
Let v3 = 20;
//Divide v1 and assign to v2 and v3
Let randomNumber = ROUND((rand()*1),0.1);
Trace Random number: $(randomNumber);
Let v2 = Floor($(v1)*randomNumber) + $(v2);
Let v3 = $(v1) - Floor($(v1)*randomNumber) + $(v3);
//Print data:
Trace V1 value: $(v1);
Trace V2 value: $(v2);
Trace V3 value: $(v3);
Outcome:
I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members.
Thanks, worked perfectly.