Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Below are some of the value i have got for one of my columns CornerTool :
Value1 : "SERIAL-LOCAL;Orthogonal;
Value 2 : PARALLEL-LSF;Incremental;smartDCOP=t
Value 3 : SERIAL-LOCAL;Factorial;smartDCOP=t
I need to have a filter list box which should display Incremental and Orthogonal.When the user clicks on Orthogonal , all the values in which the work Orthogonal is there should be select , same thing with Incremental.
How do i achive this..
Please Help..
And I guess I'm still not understanding, because even based on your clarification, what I said sounds like the solution. Well, except I have a bug in it since I didn't include the delimiter:
subfield(CornerTool,';',2) as NewField
Or are you trying to say you don't want 'Factorial' as a value? I suppose we could do this:
if(match(subfield(CornerTool,';',2),'Incremental','Orthogonal'),subfield(CornerTool,';',2)) as NewField2
See attached for it doing what I think you're asking for. Or am I still not getting it?
If I understood your question, create a new field in the script:
subfield(CornerTool,2) as NewField
Hi
I think my question is not clear here , what i need is a list box which displays
Orthogonal and Incremental
When i select Orthogonal from that list box it should give me the data for cornorTool values in which Orthogonal is present.
Samething with Incremental.
Hi
I think my question is not clear here , what i need is a list box which displays
Orthogonal and Incremental
When i select Orthogonal from that list box it should give me the data for cornorTool values in which Orthogonal is present.
Samething with Incremental.
And I guess I'm still not understanding, because even based on your clarification, what I said sounds like the solution. Well, except I have a bug in it since I didn't include the delimiter:
subfield(CornerTool,';',2) as NewField
Or are you trying to say you don't want 'Factorial' as a value? I suppose we could do this:
if(match(subfield(CornerTool,';',2),'Incremental','Orthogonal'),subfield(CornerTool,';',2)) as NewField2
See attached for it doing what I think you're asking for. Or am I still not getting it?
Or you can also use the functions wildmatch and upper. It doesn't matter where the location of the values are stored within
the string. As long as there is a value called Orthogonal or Incremental in the string, it will be displayed in the listbox.
LOAD *
,subfield(CornerTool,';',2) as NewField
,if(match(subfield(CornerTool,';',2),'Incremental','Orthogonal'),subfield(CornerTool,';',2)) as NewField2
,if(wildmatch(upper(CornerTool),'*INCREMENTAL*'),'Incremental',
if(wildmatch(upper(CornerTool),'*ORTHOGONAL*'),'Orthogonal')) as NewField3
INLINE [
CornerTool
SERIAL-LOCAL;Orthogonal;
PARALLEL-LSF;Incremental;smartDCOP=t
SERIAL-LOCAL;Factorial;smartDCOP=t
];
That works too, and is perhaps more clear. However, the reason I wouldn't recommend it is that you're buying yourself more maintenance trouble when you need to add new values. With the subfield expression, if you add another five values, you just add them directly to a list. With the wildmatch approach, you have to have a new line of code for every value, and the value appears twice in each new line of code, making a typo more likely.
Mind you, if the list gets very long, neither approach is truly ideal. We might want to consider using an inline mapping table, giving us yet another option (and I'll go ahead and do the upper to initial caps conversion like you did):
Keep:
MAPPING LOAD X, X as Y INLINE [
X
Incremental
Orthogonal
];
,applymap('Keep',capitalize(subfield(CornerTool,';',2)),null()) as NewField3
There might be an even cleaner way, but that's as clean as it gets at least for how much you add for each new value. It's just each new value, no quotes or commas, and it's in a logical, organized place. Probably not worth it unless we have more values, though. I'd probably switch over at around five or ten values.