Jump to content
  • 0

Sql Insert Into Statement


WillJennings

Question

I was wondering if it is possible to insert the result of a calculated field back into the data table I'm using as a data source with the SQL INSERT INTO function?  I'm using SQL to create a SUM within the calculated field already.  This is what I have and it works:

 

SELECT


SUM (CASE
    
       WHEN  [@field:ReturnMaster_File_Type] = 'Federal' AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = '' THEN     


             [@field:InfusionsoftCustomers_a2014_Fed_EF_Fee]


       WHEN  [@field:ReturnMaster_File_Type] = 'State'  AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = ''THEN 


             [@field:InfusionsoftCustomers_a2014_State_EF_Fee]


       ELSE 0


END) FROM _v_BillingView where ReturnMaster_EFIN = target.[@field:ReturnMaster_EFIN]




I'm not super familiar with SQL but I was thinking it might be possible.  I was trying something like this:




INSERT INTO BillingView (InfusionsoftCustomers_AmountBilled2)


VALUES


(SELECT


SUM (CASE
    
       WHEN  [@field:ReturnMaster_File_Type] = 'Federal' AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = '' THEN     


             [@field:InfusionsoftCustomers_a2014_Fed_EF_Fee]


       WHEN  [@field:ReturnMaster_File_Type] = 'State'  AND


             [@field:ReturnMaster_ACCEPTED] <= '2/15/2015' AND


             [@field:ReturnMaster_Sent] = ''THEN 


             [@field:InfusionsoftCustomers_a2014_State_EF_Fee]


       ELSE 0


END) FROM _v_BillingView where ReturnMaster_EFIN = target.[@field:ReturnMaster_EFIN])
 
Of course this comes back as Invalid.  Since I'm not familiar with SQL I wasn't sure if my syntax was wrong or if it just ins't possible within Caspio.  Any insight would be greatly appreciated.
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi, just to add in the previous comments above, you can also have a field and set the form element of that field to Calculated Value so that  you can store/save its result to the table. In a addition as well with to the triggered action workaround, you may consider checking this video: 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...