Type conversion is not possible Text + Integer

Berno_SBerno_S Member Posts: 21
edited 2021-03-05 in NAV Three Tier
I'm trying to compile some runtime upgraded object 2009->2013->2015->2016 and i get this error8roydtlg0uct.png
But Counter is Integer and not a text, even if I delete it as a variable and add it again the error comes back, this counter is printed multiple times in this report, so making a new variable with a new name is not optimal for this solution.

Does anyone have clue to how solve this and/or know why it comes?

Best Answers

  • AluanAluan Member Posts: 118
    edited 2021-03-10 Accepted Answer
    Hello Berno_S,
    the Function ImportData is a built-in function, that's probably why it isn't working with the Parameter.
    So at the end you are not using your ImportData Function, but the built-in function.

    See here:
    https://docs.microsoft.com/en-us/dynamics-nav/importdata-function--database-

    The other problem, as already mentionend from irasoelbaks, it would be helpful if you can export the file. If you can export it as ".txt" you can use Pastebin and share the link here.
  • SigGunnSigGunn Member Posts: 17
    Accepted Answer
    Since this seems to be a system with modifications there are other things to check.
    Is there by any chance a text field in table Sales Header named Counter or a function Counter returning Text in Sales Header?
  • SigGunnSigGunn Member Posts: 17
    Accepted Answer
    I would try

    Rec.RecordID := RecRef.RECORDID;

    (Actually I checked the code for Page 99009049 in a LS-Retail system in BC14 which I have access to to make this suggestion :wink: )

Answers

  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 119
    edited 2021-03-05
    I can reproduce the error you get:
    sk3v7mwerty8.png
    Cause: datatype of Counter is Text and should be Integer. Did you declared Counter as Text? Please check and share the results here so someone can check it double.
    y0ps29b9xcda.png


  • Berno_SBerno_S Member Posts: 21
    As per question it is an integer and this is why I'm asking. Btw it's a global and no local variables are defined, so it's not a global vs. local issue
  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 119
    Please send me the fob or with the isolated code then I will check it for you.
  • Berno_SBerno_S Member Posts: 21
    > @irasoelbaks said:
    > Please send me the fob or with the isolated code then I will check it for you.

    Will make an fob when I'm back on the office Monday
  • Berno_SBerno_S Member Posts: 21
    edited 2021-03-10
    Just had nother task so a little delayed, I tried to make a fob and a txt of the objects, but I'm not allow to attach here. So I can only show you in pics
    9ixamp5zcqo3.png
  • irasoelbaksirasoelbaks Netherlands, theMember Posts: 119
    edited 2021-03-10
    Also show the locals in the specified trigger please
  • Berno_SBerno_S Member Posts: 21
    there are non
  • Berno_SBerno_S Member Posts: 21
    edited 2021-03-10
    another "funny" compilation error after runtime upgrade is 2 functions have parameter placement changed etc.
    func1(text,boolean) compiles in 2013, but not in 2016
    error text = boolean
    if I change it to:
    func1(boolean,text) it compiles in 2016
    but going to the function in the code it still show as if the parameters has to be (text,Boolean)
    i80ndbr175t6.png
  • AluanAluan Member Posts: 118
    edited 2021-03-10 Accepted Answer
    Hello Berno_S,
    the Function ImportData is a built-in function, that's probably why it isn't working with the Parameter.
    So at the end you are not using your ImportData Function, but the built-in function.

    See here:
    https://docs.microsoft.com/en-us/dynamics-nav/importdata-function--database-

    The other problem, as already mentionend from irasoelbaks, it would be helpful if you can export the file. If you can export it as ".txt" you can use Pastebin and share the link here.
  • Berno_SBerno_S Member Posts: 21
    edited 2021-03-10
    Aluan wrote: »
    Hello Berno_S,
    the Function ImportData is a built-in function, that's probably why it isn't working with the Parameter.
    So at the end you are not using your ImportData Function, but the built-in function.

    See here:
    https://docs.microsoft.com/en-us/dynamics-nav/importdata-function--database-

    The other problem, as already mentionend from irasoelbaks, it would be helpful if you can export the file. If you can export it as ".txt" you can use Pastebin and share the link here.

    Ahh I see so because this is now an integrated function i NAV 2016 but was not in 2013 R2 this gives a some funny errors.

    Here's the first problem:
    https://pastebin.com/v6Dw5PTE

    I just checked the Importdata function and see that has changed to capital letters so I will have to the custom object from the solution ment to run on 2016 and not the runtime upgraded one.
  • AluanAluan Member Posts: 118
    edited 2021-03-10
    Thank you. The part with the Counter is working at my side. Can you recompile the object and try it again?
    If that doesn't work remove the counter variable and add it again.

    I think you have to rename the function, the capital letters shouldn't matter. As far as i know it shouldn't matter if you type ImportData or ImPORTdatA, the result is the same.


  • Berno_SBerno_S Member Posts: 21
    Aluan wrote: »
    Thank you. The part with the Counter is working at my side. Can you recompile the object and try it again?
    If that doesn't work remove the counter variable and add it again.

    I think you have to rename the function, the capital letters shouldn't matter. As far as i know it shouldn't matter if you type ImportData or ImPORTdatA, the result is the same.


    I have tried recompile and also remove and add it again, same error.
    I'll just have to change the name for the variable :(

    Letter Case is not important, but if it becomes all upper case it's a sign that it's an integrated function, so the fix is as you say to rename the function, but this must have been done in a newer version of the module, so I'll take this object. the Counter stuff is the strange one.
    and now also this:
    ht3t1nazlo9x.png
    :s
  • AluanAluan Member Posts: 118
    That's strange,
    can you reinstall the Development Environment?
  • Berno_SBerno_S Member Posts: 21
    Aluan wrote: »
    That's strange,
    can you reinstall the Development Environment?

    I have tried the SQL backup in different Dockers too and same error comes
  • SigGunnSigGunn Member Posts: 17
    Accepted Answer
    Since this seems to be a system with modifications there are other things to check.
    Is there by any chance a text field in table Sales Header named Counter or a function Counter returning Text in Sales Header?
  • Berno_SBerno_S Member Posts: 21
    SigGunn wrote: »
    Since this seems to be a system with modifications there are other things to check.
    Is there by any chance a text field in table Sales Header named Counter or a function Counter returning Text in Sales Header?

    You where correct never thougt about that and it was added after the first runtim upgrade from 2009 to 2013 R2, so this the report has not been compiled since the field was added and must not have been used after either.

    Now it's all starting to get together do you have a bid on the recref error too :)
  • SigGunnSigGunn Member Posts: 17
    Accepted Answer
    I would try

    Rec.RecordID := RecRef.RECORDID;

    (Actually I checked the code for Page 99009049 in a LS-Retail system in BC14 which I have access to to make this suggestion :wink: )
Sign In or Register to comment.