Page 1 of 1

Help With rule

Posted: Tue Sep 10, 2013 4:34 pm
by Kazêh
Hello guys,

Question about rules

I have a cube with 3 dimensions called "validacion viajes",Origen, Destino, Transporte ( Avion,Auto, Bus)
the Origen and Destino are pretty much de same, with cities from my country( Santiago , valdivia, arica, iquique, etc...)

if you select Avion(plane), you cannot fly to the same origin and destiny, it doesnt make sense, so i create this cube with 0 and 1, putting a 1 to the valid travels depending on the transport.

now in my other cube (PPTO Viajes) i have the follow dimensions:
-. N° (1,2,3,4.......40)
-. Medidas PPTO Viajes( measure dimension with Pasajero(passenger), Fecha(date), Origen(origin), Destino(destiny), Duracion(duration), Costo Pasaje(ticket Cost), Descuento(discount) )
where Pasajero, Fecha, Origen, Destino are string elements with picklists.
Descuento is a string element too without picklist.

-. Ramos ( ramo1,ramo2, ramo3....)
-. Moneda (UF, CLP)
-. Version(version1,version2...)
-. Canal (canal1..canal2)
-. Gerencia(managements)( gerencia1..gerencia2)
-. Control de Gestion( gestion)


with the picklist the client select one of the managements, the date (Ago, Sep, Oct) , origin, destiny and transport, if the crossing is not correct discount should say ( Not valid ) , in the contrary (OK)
( discount is a string element) and get me the ticket cost.

forget about getting the ticket cost for know, the first thing i want to do is to make that cossing validation for the origin and destiny.

i writed this on PPTO Viajes.

['Sin Canal','Sin Ramo','Descuento']= S: if((DB('Validacion Viaje',!Origen,!Destino,'Avion')@='1')&(DB('PPTO Viajes',!Control de Gestion,!N°,!Version,'Sin Canal','Sin Ramo',!Moneda,!Gerencia,'Transporte')@='Avion'),'OK','No aplica');

where "Sin canal" is from Canal Dimension
"Sin Ramo" From Ramo Dimension
"Descuento" from Medidas PPTO Viajes (measure dimension)


Im getting an invalid string expresion near !origen, !destino,'Av

I dont really get what im doing wrong here, if you guy can help me I will be very grateful. Sorry for my bad english tho!, if you didnt understand what i asked i will write it again!.
Thanks.

Re: Help With rule

Posted: Tue Sep 10, 2013 4:50 pm
by qml
I suspect that Validacion Viaje stores numeric values, not strings, so you shouldn't be using a string comparison. Try this:

['Sin Canal','Sin Ramo','Descuento']= S: if((DB('Validacion Viaje',!Origen,!Destino,'Avion') = 1)
& (DB('PPTO Viajes',!Control de Gestion,!N°,!Version,'Sin Canal','Sin Ramo',!Moneda,!Gerencia,'Transporte')@='Avion'),'OK','No aplica');

Re: Help With rule

Posted: Tue Sep 10, 2013 5:02 pm
by Kazêh
still getting the same error, near !origen,!destino , 'Av

it has something to do with this?

Origen and Destino are elements from Measure dimensions from PPTO Viajes
but "validacion viajes" has Origen and Destino as a dimension ( not as an element) ?

i dont know why i think if i change the names of the dimension would work...

Re: Help With rule

Posted: Tue Sep 10, 2013 5:52 pm
by Kazêh
welp, that didnt worked eather :oops:

Re: Help With rule

Posted: Tue Sep 10, 2013 6:50 pm
by qml
If dimensions Origen and Destino do not exist in the PPTO Viajes cube then you cannot use the !dim reference notation for them, you will have to come up with something else - e.g. dimensions that map to Origen and Destino (they can have different names), attribute values, hard-coded references etc.

Re: Help With rule

Posted: Tue Sep 10, 2013 8:12 pm
by Kazêh
yeah, adding the Origen and Destino dimension to the PPTO Viajes makes my rule work, but is out of the question.
Need to find another way to do this, and i was thinking about adding atributes to the Origen and destino dimension. one atribute per transport for each dimension and ask if the atributes are the same.
or something like that.

Do you guys have any others sugestions?

Thanks.

Re: Help With rule

Posted: Tue Sep 10, 2013 8:37 pm
by qml
Kazêh wrote:Need to find another way to do this, and i was thinking about adding atributes to the Origen and destino dimension. one atribute per transport for each dimension and ask if the atributes are the same.or something like that.
There must be a logical, business-driven connection between at least one of the dimensions in PPTO Viajes and the location dimensions, correct? I mean, otherwise why would you even write such a rule? You need to identify that dimension or add it to the cube and then you should add a mapping attribute to that dimension to link it to Origen and Destino and reference the attribute in your rule. If there is no such dimension, you will need to hardcode specific values e.g. 'Santiago'.

Re: Help With rule

Posted: Tue Sep 10, 2013 8:50 pm
by Kazêh
thanks qml for all your replies, I'm not very familiar with drivers dimension, so i shall begin the searching.
Do you know if there is a manual with basis examples for this?
If not it's ok. those "drivers" remind me the allocations and i think there are manuals for that.

thanks.

Re: Help With rule

Posted: Tue Sep 10, 2013 9:18 pm
by qml
I am trying to talk in as simple terms as possible and I was not referring to any 'drivers dimensions', whatever that would mean. All I was trying to say was that there must be some real-world requirements that should in a natural way translate to your model design and your rules. Maybe you should go back and think why you are writing rules in a cube that has no geographical dimension that are based on a cube that has two geographical dimensions and what the business meaning of what you are trying to do is. Once you answer these questions the technical solution should come naturally.

Re: Help With rule

Posted: Thu Sep 12, 2013 7:14 pm
by Kazêh
i did it , i made comparations with DB function and got the validation i wanted, im still polishing it tho.
Thanks for the patiente qml, sorry if i don't quite understand what you suggest or if i dont make myself clear, like "drivers dimensions".


this is what i came out with:
['Sin Canal','Sin Ramo','Descuento'] = S: if((DB('PPTO Viajes',!Control de Gestion,!N°,!Version,'Sin Canal','Sin Ramo',!Moneda,!Gerencia,'Origen')@=DB('PPTO Viajes',!Control de Gestion,!N°,!Version,'Sin Canal','Sin Ramo',!Moneda,!Gerencia,'Destino')&DB('PPTO Viajes',!Control de Gestion,!N°,!Version,'Sin Canal','Sin Ramo',!Moneda,!Gerencia,'Transporte')@='Avion'), ' No Aplica' , CONTINUE);


tthis is my first example, there are a few more, but it works fine now. Again, Thanks.

Kazêh