Problem using SELECTSTR

shettarvikasshettarvikas Member Posts: 106
Hi,

From web service, I am getting the data into navision as a string seprated by comma (as per HL 7 format),
Eg: Cutomer Id,First Name,Second Name, Address, Address 1...email

I tried to capture the values using SELECTSTR function, but the problem is when there is a null value in between 2 comma's. The above function gives run time error. And also I saw in Help file that if the 2 values are same in the string then it also gives run time error.

Please let me kow, is there any other solution or how can it be rectified.

Thanks & regards,
Vikas

Comments

  • AlbertvhAlbertvh Member Posts: 516
    Hi Vikas,

    You could try to use the COPYSTR function for this. I seem to recal that there is something in the Tips & Tricks forum


    Edit or you could use a dataport to accomplish this


    Albert
  • shettarvikasshettarvikas Member Posts: 106
    Hi Albert,
    I cannot use dataport, as it will take time. But using COPYSTR, can you give some more detail, like pseduocode for parsing the string..
  • garakgarak Member Posts: 3,263
    for System functions (or self defined) like copystr use the C/AL Symbol Menu (F5) :!:
    Here you see all variables, Functions and when press F1 the help for System functions. There is also an understandable example.

    Regards
    Do you make it right, it works too!
  • shettarvikasshettarvikas Member Posts: 106
    Thanks for the info. It worked
  • MaximusMaximus Member Posts: 105
    Hi,

    i also had the same problem with SELECTSTR. I made a loop that replaces null values with spaces and this solved it. But now I have a new one:
    when I have string like this: test1,-1,test2,test3,etc..

    and I process it with the following code:

    Txt := test1,-1,test2,test3,etc.. ;
    Txt1 := SELECTSTR(1,Txt);
    Txt2 := SELECTSTR(2,Txt);
    Txt3 := SELECTSTR(3,Txt);
    Txt4 := SELECTSTR(4,Txt);

    The following error occurs: parameter 2 invalid for function SELECTSTR, etc...

    What seems to be the problem here? -1 is the second value in a comma seperated string so I would expect it to run fine. The other strange thing is that this code ran fine for a few days and that strings containing -1 were processed correctly (and I am absolutely sure of this). Nothing has changed in the past few days, but today this error occurred. Can anyone explain this please?
Sign In or Register to comment.