Convert a Text to a Blob

Kylea
Member Posts: 39
I have 2 fields - 1) CreditCardNo (text 16) & 2) CreditCardNoBlob (Blob).
On Validate for CreditCardNo I want to push the text data to a blob - I understand you can use INSTREAM to do this - but I need help to get it right.
So far I have the following:
Definitions:
StreamInObj = DataType InStream
CreditCardNoProtect = BLOB
CreditCardNo = Text (16)
CreditCardNoProtect.CREATEINSTREAM(StreamInObj);
I am unsure what to do to get Credit Card No into the blob field.
Can someone show me what the code should be with an explanation on each line of how it actually works or what each line is doing. I looked at the example in the help text but not sure how much of it is relevant considering it seems to be writing messages.
Thanks
Kylea
On Validate for CreditCardNo I want to push the text data to a blob - I understand you can use INSTREAM to do this - but I need help to get it right.
So far I have the following:
Definitions:
StreamInObj = DataType InStream
CreditCardNoProtect = BLOB
CreditCardNo = Text (16)
CreditCardNoProtect.CREATEINSTREAM(StreamInObj);
I am unsure what to do to get Credit Card No into the blob field.
Can someone show me what the code should be with an explanation on each line of how it actually works or what each line is doing. I looked at the example in the help text but not sure how much of it is relevant considering it seems to be writing messages.
Thanks
Kylea
0
Answers
-
Example Send Date from a field or variable (txt1/2 is atextvariable, example use table 27):
if (txt1 <> '') then begin Picture.CREATEOUTSTREAM(StreamOut); StreamOut.WRITE(txt1); modify; end;
Read Data from BLOB and write text in textvariablecalcfields(Rec.Picture); if Rec.Picture.hasvalue then begin Rec.Picture.CREATEinSTREAM(Streamin); //while not StreamIn.EOS do begin //if you need somewhat in a loop StreamIn.READ(txt2); //end; end;
RegardsDo you make it right, it works too!0 -
Thankyou - exactly what I needed
So now I have my credit card info appearing as * in my blob field - in order to display it on a form I gather I would need to do the reverse to an InStream ie Blob to a text field so the user could see it. Is that correct.
Kylea0 -
Please, and welcome
if you got the answere you can set the attributoption solved (go to the first post, press edit, set the attribute -> optionfield on top)Do you make it right, it works too!0 -
thanks guys, this has helped me a lot !!!0
-
@kanika please bear in mind that this is a 9 years old thread. A lot has changed since, and if you are on version newer than NAV2009 I'd suggest you to look into the TempBLOB table and use standard ReadAsText / WriteAsText functions available there.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
From what version? I needed it for NAV2009 and it worked ok, but in NAV2015 I can not find any function in that table0
-
I'm just saying that in newer versions there are new standard functions handling this.
If you are on 2009 that's OK then, however you may still want to implement your change as a function in TempBLOB table, just like they are implemented now in post-2009 versions. If you use the same function names it will be a just a tiny bit easier to upgrade your system in the future.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions