Netlogo缩放颜色,具有不同的值

时间:2018-03-28 05:25:10

标签: netlogo

在NetLogo中,我使用了以下一行的scale-color:

ask patches [set pcolor scale-color green potential min-potential max-potential]

潜力是一个总是在变化的补丁变量。问题是:如何获得此变量的最小值和最大值?

1 个答案:

答案 0 :(得分:3)

那就是:

;WITH FirstQuery AS
(
    SELECT 
        allowdeductname_en, 
        SUM(SFD_comp_value_tax@;emp_id) as    GGG                                                                                                                                                                                                 
    FROM TPYDPROCMTDD md                                                                                       
    LEFT JOIN TPYDPROCMTDH mh on md.procmtdh_id = mh.procmtdh_id and 
    md.company_id = mh.company_id                                                                                                                                                                                                                                                    
    WHERE md.allowdeducttype = 'A'                                                                                                                                                                                                                                                     
    AND md.company_id = '13565'
    AND mh.company_id = '13565'
    AND year(mh.paydate) = 2017                                                           
    AND month(mh.paydate) = 1 
    AND mh.costcenter_code = 99990001
    group by allowdeductname_en
),
SecondQuery AS
(
    SELECT distinct allowdeductname_en                                                                                                                                                                                              
    FROM TPYDPROCMTDD md                                                                                       
    LEFT JOIN TPYDPROCMTDH mh on md.procmtdh_id = mh.procmtdh_id and 
    md.company_id = mh.company_id                                                                                                                                                                                                                                                    
    WHERE md.allowdeducttype = 'A'                                                                                                                                                                                                                                                     
    AND md.company_id = '13565'
    AND mh.company_id = '13565'
    AND year(mh.paydate) = 2017                                                           
    AND month(mh.paydate) = 1
)
SELECT
    S.allowdeductname_en,
    ISNULL(N.GGG, 0) AS GGG
FROM
    SecondQuery AS S
    LEFT JOIN FirstQuery AS N ON S.allowdeductname_en = N.allowdeductname_en

我建议您在let min-potential min [ potential ] of patches let max-potential max [ potential ] of patches 块之前将它们存储在本地变量中,以便每次修补程序执行ask操作时都不必重新计算它们。