Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hiee
Will anyone tell me how dual function works with exapmle
You use dual() when you need both a text and a numeric representation of a value. For instance, maybe you have a priority field.
High
Medium
Low
That's great for display, but not good for sorting, or taking the max(Priority), that kind of thing. So we might instead define it like this:
LOAD dual(Text,Number) as Priority
INLINE [
Text,Number
High,3
Medium,2
Low,1
];
Now, there might be other and even better ways to handle this particular example, but that's kind of the idea.
Dates WOULD be a very good example if they didn't have their own format. A date has a text representation like 'May 6, 2010', and also a numeric represenation, 40304. Normally, you want to see the text version, but you often want to sort and do mathematical manipulation using the underlying numeric, such as adding days to get a new date. Dual() makes some other sort of field behave similarly, where the text representation is what is normally displayed, but there's still a number in there that you can sort by and manipulate mathematically.
Hi Hardik,
You can use Dual() for this purpose, it is a dual datatype what you have to do is
if(field='A', Dual('0-20000', 1),
if(field='A', Dual('20001-40000', 2),
'
'
'
'
Now in chart the values are automatically sorted by using the second parameter in Dual().
Hope this helps you.
For more options visit this
Did you go through the help/ reference manual ? Dual is a functiobn that allows to represent a value as string while it's internal represenatation is numeric.
Ex:
Load Dual(String, Num) as Number ;
Load * Inline [
String, Num
One, 1
Two, 2
Three, 3
Four, 4
];
Here in the front end you will find Number field as string (One, Two..). However, if you use an expression like=Sum(Number), you get the numeric sum -10. This function is very useful for some situations like, when you need to sort a string field in a customized order. Here in the above example if you sort the field in numeric order you get One, Two, Three, Four, which would not be the case had the field been just a string field.