You are viewing limited content. For full access, please sign in.

Question

Question

How can I use Workflow to insert data into a SQL 2008 table?

asked on February 2, 2014 Show version history

 I am inserting data into SQL 2008 Table.  The original format of the data is 02/02/2014.   I am taking the Data from Temp Field and inserting into the Table.  The format of the field in SQL is Nvarchar(50) and on LF is Text.

 

If I send a row data as original it works and data gets inserted.   I if format the data with (\d\d)/\d\d/\d\d\d\d.  The format works when we edit the field value in the document in LF.  But it does not insert the data into the field in SQL.  I tried to create Token in Workflow too but it still didn't work.  

Any help is appreciated..

 

thanks

0 0

Answer

SELECTED ANSWER
replied on February 4, 2014

Oh, did you mean you formatted the Laserfiche date field to "MM" through the LF Administration Console? If that's the case, that's just display formatting, it does not actually change the data. Workflow ignores display formatting, so it would get the full value.

 

(%Year#<\d\d)/\d\d/\d\d\d\d>#) is still not a proper token. It has an extra ) right after the first \d\d.

1 0

Replies

replied on February 3, 2014

Like Ben says, there's not enough information on what you're doing. Straight up workflow that uses Retrieve Field Values to read the data and Insert Data to write it to a SQL table works fine for me.

 

If you're talking about formatting the data in WF's token editor, then (\d\d)/\d\d/\d\d\d\d is a regular expression, not formatting.

1 0
replied on February 3, 2014

Hi there,

 

There's not information about how you are performing the insert to work this out. What's the exact script you're using? Also, I'm unclear as the exact method you used to test the value. If workflow is doing the processing, you could use a script to display a message box - and use Designer to test the process - just to confirm the value being posted out.

 

-Ben

 

0 0
replied on February 4, 2014

Hi  

 

Here is what I am doing:

 

The original Data comes from Forms submission page.    I have Date Field that I want to Insert into SQL DB.   I need to separate Day, Month, and year and insert them into the DB.  

 

The flow of the data is from Forms to Template field than workflow picks up and inserts the data.   If I use date field on the LF Template Field and use MM format for example it works for LF field and Data that comes into LF Field is correctly formatted and shows the Month only.   But when I pass this value into SQL DB it comes in as a raw value (02/02/2014) not the Month.

 

Than I decided to use expression in the workflow field assignment for example (%"retrievedfievalue"#<(\d\d)/\d\d/\d\d\d\d>#) format which passed a blank value.  Than I tried to do the same thing using Token and passing token into the DB but still came with blank value.  

 

Let me know if you need further into....

 

 

Cheers

 

 

0 0
replied on February 4, 2014

The date format is controlled by the Windows settings for the user the WF Service is running as. Usually, the default Windows date format is M/d/yyyy (or d/M/yyyy on some localized versions of Windows). That's probably why your regular expression does not work.

 

I don't know if (%"retrievedfievalue"#<(\d\d)/\d\d/\d\d\d\d>#) in your post was a typo, but that's not a valid token.

 

Formatting a date field token with MM works for me, so at this point you probably want to open a support case and attach the workflow so we can take a closer look.

0 0
replied on February 4, 2014

Is see there was one extra ( and that is type,  (%Year#<\d\d)/\d\d/\d\d\d\d>#)  This is the actual value that I used to format that Token or the insert assignment.

 

This does not look normal to me.  I have date field in my template that is set for MM format and work fine on LF side and Show the month and I am inserting that into nvarchar(50) on SQL and I get the original non-formatted data at the end.

0 0
replied on February 4, 2014

Here I have copied and pasted the format of what I have done on the workflow

(%Month#<(\d\d)/\d\d/\d\d\d\d>#), we needed the ( for the expression to show first 2 digits.  

 

I tested this format on Token Editor and  it does return first 2 digits of the data from 02/02/2014, let me know if I am missing something.  I typed  (\d\d)/\d\d/\d\d\d\d   it returned the correct value.  I noted that the Formatted Token Section of the Token Editor shows %(month#<\d\d)//\d\d//\d\d\d\d># ), do I need to put the additional // in workflow?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.