Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In the simplifield table below, customers may belong to any of three diffrent groups - Cat_a, Cat_b or Cat_c.
All combinations are possible, YYY, NNN, YNY etc.
Selections like Cat_a="N" and Cat_b="Y" and Cat_c="N" works fine from listbox objects:
But how do I make selections like Cat_a="N" or Cat_b="Y" or Cat_c="N"? Is it possible to do that from sheet objects?
I'm stuck. Any advice are welcome!
Anders
Generally speaking, you can't do that. Selections in one field are OR. Selections in multiple fields are AND. However, we could take advantage of that to kluge together a solution. You just need to put all of your selections in one field. There is probably a better solution, and I'm probably going to feel stupid when I think of it or someone else posts it, but so you aren't left with NO options until then, here's an example of what I'm saying:
RawData:
LOAD * INLINE [
ID,A,B,C
1,Y,N,N
2,N,Y,N
3,Y,N,Y
4,Y,Y,Y
5,Y,N,N
6,N,N,N
7,Y,Y,Y
];
OrTable:
LOAD ID,'A=' & A AS Cat RESIDENT RawData;
CONCATENATE (OrTable) LOAD ID,'B=' & B AS Cat RESIDENT RawData;
CONCATENATE (OrTable) LOAD ID,'C=' & C AS Cat RESIDENT RawData;
Here's a more user-friendly though also more complicated solution. Rather than put all of the selections in a single field, we handle EVERYTHING in the data model. Since the data model is implementing the OR, the OR table can get quite large. In this case, we have 7 IDs with 3 fields with 2 values each, for up to 7 * 2^3 rows. This will obviously be impractical for large numbers of fields or large numbers of values in each field. But if it's only a few fields with a few values, and your raw data table isn't TOO huge, it should be workable.
I'm fairly confident that the creation of the OR table could be written as a loop of some sort, and there's a much more efficient way to get distinct values of a field. I may upgrade the example later, as this question comes up every now and again. I'm still hoping there's a better solution, as this one has significant weaknesses (complexity, required RAM).
Thanks for your time, John.
Yes, its a HUGE table, several millions rows ant a lot of fields...
I'll test some modifications in the data model.
Thanks again!
Anders