English (United States)
Call us! 512-349-0334 or (877) INDUSOFT

InduSoft Web Studio Forums

Find additional forum posts in in the Forum Archives. For assistance view the Forum Frequently Asked Questions.

SQL Where query execution
Last Post 13 Mar 2019 12:36 PM by sriking89indusoft. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
sriking89indusoftUser is Offline
New Member
New Member
Posts:3


--
09 Mar 2019 03:41 AM
    Hi there,
    I use Indusoft IWS8.0 & I have created a sample Production data Date&time, MachineNo,Production Data with SQL Server 2008 DB. Need to Filter the data as Filtering options with FROM & TO. I Can able to filter the data for the Date option as per the "Condition" in the Grid Objects.. How can i execute the SQL "where" instruction with "Condition" option in this.

    Can anyone help me?

    RAM

    Condition_Option.pngSQL_Data_result.png
    ElectrocontrolUser is Offline
    Basic Member
    Basic Member
    Posts:13


    --
    11 Mar 2019 05:15 AM
    i usually use 2 methods for that:
    1st one is do the filter in the database, whenever i enter the window i drop the view linked to the grid object. Then i use two DateTimePicker (.NET) to select FROM date and TO date. Whenever the user have selected the two dates, he has to press a button which generates a new view in the DB and refresh the grid object. IMPORTANT, you must converte the data string into SQL string using the DB instruction STR_TO_DATE()
    2nd is using the condition field from the grid object. The two dates that the user selected in the DateTimePicker's (date1 and date2) build a filter string tag:
    $filter = "[columndate]>= '"&$date1&"' AND [columndate] <= '"&$date2&"' " . Last, write {filter} in the condition field.
    EDIT:
    Example method 1
    WHERE mz.date >= STR_TO_DATE(Replace(Replace('"&$fromdatefilter&"','/',','),':',','),'%d,%m,%Y %H,%i,%s') And mz.date < STR_TO_DATE(Replace(Replace('"&$finaldatefilter&"','/',','),':',','),'%d,%m,%Y %H,%i,%s')
    This example is a fragment from a sql string execute by $DBExecute


    sriking89indusoftUser is Offline
    New Member
    New Member
    Posts:3


    --
    13 Mar 2019 12:36 PM
    Thanks a lot..


    You are not authorized to post a reply.