![]() |
Script for text to integer not working |
Post Reply ![]() |
Author | |
Liam ![]() Admin Group ![]() ![]() Joined: 29 Jun 2011 Location: Stoke-on-Trent Points: 266 |
![]() ![]() ![]() ![]() ![]() Posted: 09 Jun 2020 at 9:36am |
Is the script actually working at this point?
I noticed your add to log action, is this showing that the item is being updated to 1 or 0?
|
|
![]() |
|
bickell ![]() New User ![]() ![]() Joined: 11 Jun 2007 Location: Kansas City, MO Points: 37 |
![]() ![]() ![]() ![]() ![]() |
Also tried the following, but still can't get the database field to update to 1.
Sub Main() ' commands start here 'ThinkAutomationExtract = ThinkAutomationExtract Dim PreviousASIString As String Dim prevASIBit As Integer PreviousASIString = ThinkAutomationMessage.ExtractedFields("PreviousASI").Value Call AddToLog("Extracted field value: " & PreviousASIString) Select Case PreviousASIString Case "Yes" prevASIBit = 1 Case "No" prevASIBit = 0 End Select ThinkAutomationExtract = prevASIBit Call AddToLog("Converted field value: " & ThinkAutomationExtract) End Sub |
|
![]() |
|
bickell ![]() New User ![]() ![]() Joined: 11 Jun 2007 Location: Kansas City, MO Points: 37 |
![]() ![]() ![]() ![]() ![]() |
I set up the following script to convert a field that comes in as text (either "Yes or "No") to a value of 1 or 0 so that it can be written to a bit (boolean) field in MS SQL.
The script does not work as written and I am not sure what I have done wrong. When the value is "Yes" in the email, the database field that is mapped to this extracted value is being written as 0. Sub Main() ' commands start here ThinkAutomationExtract = ThinkAutomationExtract Dim PreviousASIString As String Dim prevASIBit As Integer PreviousASIString = ThinkAutomationExtract Select Case PreviousASIString Case "Yes" prevASIBit = 1 Case "No" prevASIBit = 0 End Select ThinkAutomationExtract = prevASIBit End Sub Any help would be appreciated.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |