# Result based on previous Result

This topic is 6598 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I need to produce a result, based on the last occurance of the same result. I have a calulation that based on different criteria, dispalys different results. One of those results needs to display a different result based on what occured the last time that it occurred was. So if it was result "a" than the next time it occurs, it needs to be "b".

To further explain the calculation looks something like this - If(fieldvalue = "X" and fieldvalueB = "X", "AA",

If(fieldvalueA= "X" and fieldvalueC ="X", "B" etc..

The last condition needs to show "C" the first time, and "D" the next time it occurs.

I think i need to have a related DB hold the result, and have it check for the previous value when it occurs next.

##### Share on other sites

One of those results needs to display a different result based on what occured the last time that it occurred was.

If someone interprets this into English, let me know.

##### Share on other sites

Hi Queue,

I think he put a "Twist" to it.

##### Share on other sites

Apparently so. I'm also thinking that his first 'fieldvalue' should be 'fieldvalueA'. But I still can't deduce what the goal is.

##### Share on other sites

I think the goal is to produce a goal, based on the last result of the same goal.

##### Share on other sites

I wonder if this is actually Ugo using an alias to mess with our heads?

##### Share on other sites

I think the result is 42

To get this result set up the following calculation:

Result = 42

This will produce a result based on the last result answer of .... 42.

Charles

##### Share on other sites

I swear I've never been to Florida before.

##### Share on other sites

Thanks for all of your help. twist

##### Share on other sites

If( Timeframe_under30 = "X" and Purchasing20plus = "X" and Action_Rep_Lit = "X", "AA",

If( Timeframe_under30 = "X" and Planning = "X" and Action_Rep_Lit = "X", "AA-",

If( Timeframe_1to3mths = "X" and Purchasing20plus = "X" and Action_Rep_Lit = "X", "A",

If( Timeframe_1to3mths = "X" and Planning = "X" and Action_Rep_Lit = "X", "A-",

If( Timeframe_4to6mths = "X" and Purchasing20plus = "X" and Action_Rep_Lit = "X", "B",

If( Timeframe_4to6mths = "X" and Planning = "X" and Action_Rep_Lit = "X", "B-",

If( Timeframe_greater6mths = "X" and Purchasing20plus = "X" and Action_Rep_Lit = "X", "C",

If( Timeframe_greater6mths = "X" and Planning = "X" and Action_Rep_Lit = "X", "C-",

If( PurchasingLess20 = "X" and ActionC10_G9_E9a = "X", "Preferred Reseller",

If( PurchasingLess20 = "X" and ActionC10_G9_E9b = "X" , "online purchase", ""))))))))))

The second to last result "Preferred Reseller" can have 2 values. I need to alternate the values. So if the last time that this calculation resulted in preferred resellerA, the next time it needs to be preferrred resellerB.

Am speaking in a language you can understand now?

##### Share on other sites

First thing.

Wouldn't it be possible to have a unique TimeFrame field ?

Second, but may be related.

Is your structure based upon repeating fields ?

Third.

What is Previous and Next depend upon your structure. Would it be that you are searching the last Record ?

##### Share on other sites

I don't think you'll be able to do this with a pure calculation. It will, I think, require a script that takes the value of Preferred Reseller from a field, and then using the SetField command, sets Preferred Reseller to the value that it wasn't. Something like:

If [PurchasingLess20 = "X" and ActionC10_G9_E9a = "X", Preferred Reseller]

If [Preferred Reseller = 'A']

SetField [Preferred Reseller = 'B']

Else

SetField [Preferred Reseller = 'A']

End If

The next time the script runs it will take the other Preferred Reseller

Dan

##### Share on other sites

I think what he's getting at is looking at the Reseller value from the previous record. A scenario of what's going on would be helpful, I think.

##### Share on other sites

Possibly, except for all those ******* Xs. Should we assume you mean '1', as in, the field is formatted as a checkbox and has been selected? If so, you can simplify your calc to something like:

Case(Action_Rep_Lit,

Case( Timeframe_under30, Case(Purchasing20plus, "AA", Planning, "AA-"),

PurchasingLess20, Case(ActionC10_G9_E9a, "Preferred Reseller", ActionC10_G9_E9b, "online purchase"))

And we still need to know how you're determining the "last time" preferred reseller was the result.

##### Share on other sites

Ah, I was interpreting "last time" as the last time the activity was carried out rather than as the last record.

##### Share on other sites

I think it would be the 'last' record that had either preferred resellerA or B as its result. This could work with a self-relationship from the calc to itself, perhaps. But it will have to exclude the current record or Last( ) will return its value.

##### Share on other sites

It just seems like this could be solved by setting the value of the current record's Preseller into a global via a script and then referencing the global the next time the value was needed via another script (if it's the case that the calc needs to be stored) or directly in the calculation (if the calc doesn't need to be stored).

##### Share on other sites

• Newbies

The scenario is that, my company is taking inbound phone calls from prospective buyers, who either get the phone number from the manufacturers website or recieve an marketing mail piece.

They then call in and answer questions, among them a timeframe question, unit amount,and planned initiatives to purchase. Those are the questions that "qualify" a Lead Type (AA,AA-,A, etc). What i am after is,the second to last result in the calculation "Preferred Reseller" can have one of two values.

This result may not happen each and every time someone calls in and answers questions. That is really determined by the amount of units they will be purchasing (less thatn 20). So, I'm not looking at the previous record, but the last record that resulted in "Preferred Reseller", as DanBrill stated.

As for a unique Timeframe field,or any of those referenced, the data is exported then email to another vendor, who imports it into a sales database (like SalesForce.com)thus resrticting my formatting. Due to this, questions that have multiple choice are value list of checkboxes, and an export field substituing the breaks for comma's and no they are not based on repeating fields.

I believe DanBrill is pointing me in the correct direction, using the set field script step, but am open to any other suggestions

Thanks to all,

Twist

##### Share on other sites

And the 'global' would actually need to be a 'universal', a text field in a single record prefs type file.

##### Share on other sites

This topic is 6598 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account