8

When we use C# with the Universe database the multi values are coming from the Universe Database as comma separated values to the programming site. Normally in Pick Basic language programming they come up as a ^252 or ^253 separated values. Therefore we can split the multi value easily with value separators because people don’t use the ^252 or ^253 in normal data entries.

But in C# when we select multi values from the Universe database they comes up with comma separated. If the multi value data actually contains a comma then we can’t use the comma value(,) as a value separator. Because this will split the multi value data in the wrong position.

For example if the multi value data is :

01 Although , we will do , Tom goes there , I will come down

The multi value for the above record are separated by a comma in the .net programming. But the first value(in bold) actually contains a comma after the “Although”.

We are facing problem to use the C# Split function to separate the data and get the individual values. Could you tell us how can we can overcome this in C# orVB.net programming with Universe database and get the individual values/sub values? .

Thank you.

Explorer
  • 295
  • 1
  • 12
  • 2
    +1 .. very good question as this is a very difficult problem. Are you able to put the token in double quotes. Such as: 01 "Although , we will do" , Tom goes there , I will come down – Luke101 Oct 16 '13 at 02:22
  • Perhaps you could store every comma in your entries with its unicode value `U+002C` and change it back after retrieving everything? – Jeroen Vannevel Oct 16 '13 at 02:31
  • 3
    Check out how comma is handled in [CSV](http://en.wikipedia.org/wiki/Comma-separated_values), also it feels really bad idea to return data from DB in CSV format rather than list of values or name/value pairs. – Alexei Levenkov Oct 16 '13 at 02:32
  • 3
    Agree with @Alexei-Levenkov: you should be able to rewrite the C# code to return data as a structured collection instead of comma-separated strings. Perhaps you could post your code? – groverboy Oct 16 '13 at 02:57
  • 3
    We need more information. The native connectors for that database won't return the delimiters as comma's, so what is changing them in your case? Do you have control over that piece? You will need to if you want to solve this, unless you can encode the data before-hand to escape the commas. – Dan McGrath Oct 16 '13 at 04:12
  • 1
    The code example which reads data from your database is needed here. – G.Y Oct 21 '13 at 15:07
  • As others have said, it will really help if you show us the code that you are using right now. – Moshe Katz Oct 22 '13 at 20:24
  • Can a comma only occure in the bold block or also in the "Tom goes there" and "I will come down" block? If not you could seperate by the first and the last two commas and all other commas would be part of the (in this case) bold part. – Mickey Oct 24 '13 at 08:00

1 Answers1

2

In general field delimiters are required precisely for the problem you are describing. If you use " you will then also need to decide what to do when your data inside a field also holds a " in it.

When you have found a good field delimiter (one with small memory foot print and that your data is not likely to contain). You can create a regular expression to grab the data from each field.

Like others have said, some code snippets or samples will mean that answers are more accurate and helpful.

Is there anyway you can bring the data back into a specific Type, for example MS DataTable or your own structure? List, where Row is a Type you create to store all possible fields in your specific data model?

yonsk
  • 163
  • 1
  • 8