ASCII Code in C/Side Code

sakameeransakameeran Member Posts: 52
Hi Experts,
Is there any ways to use ASCII codes in C/SIDE Code language?
For example, In Report i am getting output as "HS0001, HS0002, HS0003" in a single variable. I want to put ASCII Code of "Enter" instead of ','.
I mean my output should be like
HS0001
HS0002
HS0003
instead of HS0001,HS0002,HS0003.
Is that possible to do so? IF any alternate solution is for this?

Comments

  • androjdazandrojdaz Member Posts: 20
    Use character '\' for creating new lines instead
    That's what she said!
  • john.fojohn.fo Member Posts: 16
    the Backspace will work in a message, but not in a report.
    If you want to put it on seperate lines on a report I guess you will have to split the variable into as many texts as you want to and use an integer dataelement for output.

    Example:
    Variables;
    NoOfTexts: integer
    Intext: Text(100) 'Text1, text2, text3'
    OutText: Text(30)
    InTextArray: Text(30) Dimensions maybe 30 or how many you need
    end of variables
    
    NoOfTexts = fnsplit(Intext) // splits the text into TextArray: number of commas in text + 1 - use STRPOS and a loop (FOR i := 1 to STRLEN(InText))
    
    Integer - OnPreDataItem
    SETRANGE(Number,1,NoOfTexts);
    
    Integer - OnAfterGetRecord
    outtext = InTextTable[Number];
    //then use outtext in the body section for integer
    
    

    Anyway that's how I would do it

    Best regards
    John
  • androjdazandrojdaz Member Posts: 20
    I am not quite sure what you are trying to do..
    Simply create text box, make it MultiLine enabled and set SourceExpr to 'First Line Text\Second Line Text'
    That's what she said!
  • john.fojohn.fo Member Posts: 16
    Hi Androjdaz,

    It all depends on what you have to do.

    With your solution the text will always take up the same space on the report regardless of how many texts should be split and put out - maybe that's ok - we don't know from the question.

    My solution takes up one line per text so if it should be split up in 4 there will be 4 lines - if it's just one it will take up one line on the report.

    If you know that you will receive 3 textbits (or a maximum that fits in your textbox) your solution is much easier :)

    br.
    John
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.