笔者前面发过一篇帖子:灵活运用Rend函数,选项随机排序垂手可得https://bbs.fanruan.com/thread-135687-1-1.html文中,笔者自我感觉良好,但是功能构建毕竟是极其粗暴地用控件堆叠而成,有道友反馈,虽依葫芦画瓢,但鉴于我的表达能力可能不够清晰,或者因控件太多展现不够直观,所以道友始终不得其门而入。我也感觉挺郁闷的。在仔细一构思,对着函数温故而知新,原来我少有用SCACH公式来表达, 导致结构复杂。对此非常抱歉,特发修正,请道友们参阅此文档。与前文相比,本次改进毋须借助数据工厂整理数据,应用的表达式逻辑清晰,更好扩展,省事省力。在功能上与前文保持一致,主要实现的功能有:1、自动按出题数量添加行2、自动随机打乱抽题顺序3、自动随机打乱选项顺序4、前后选项数量保持一致5、系统自动进行答题批改6、ABC答案不区分大小写7、复选框不区分单选、多选8、预计实现多选少选有效得分对于多项选择逻辑解读,需要的朋友请参阅官方文档:https://t6ixa9nyl6.jiandaoyun.com/sharedoc/7dca4jXgHiAiW3fi6wgqXb补充完善应用的搭建,与前文一样,请道友们熟悉主要应用的三个函数表达式:
1、INT(RAND()*(b-a)+a):获取一个大于等于 a 但小于 b 的随机整数
2、SPLIT(text, text_separator):将文本按指定字符串分割成数组并取出数组中第N个数据。
3、SEARCH(find_text,within_text,)
返回第一个文本字符串在第二个文本字符串中第一次出现的位置序号,从左到右查找,返回 0 则表示未查找到。
(约相当于子表单分行取数)
一、题库的建设参考图片,(全部单行文本也可以):https://ub35s32n7x.jiandaoyun.com/f/60bf88acd10ad1000802f8db
144356
二、答题页面建设参阅外链:https://ub35s32n7x.jiandaoyun.com/f/60bf7bf0808cd500081d5d03
方案一:固定四个选项设置
144475
随机数:INT(RAND()*题库+1)
试题:CONCATENATE(试卷.题干,CHAR(10),"--------------------",CHAR(10),"A、",SPLIT(试卷.选项,"-")-1],CHAR(10),"B、",SPLIT(试卷.选项,"-")-1],CHAR(10),"C、",SPLIT(试卷.选项,"-")-1],CHAR(10),"D、",SPLIT(试卷.选项,"-")-1])
选项随机:UNION(SPLIT(CONCATENATE(INT(RAND()*4+1),",",INT(RAND()*4+1),",",INT(RAND()*4+1),",",INT(RAND()*4+1)),","),"1","2","3","4")
转换:"ABCD"-1]
标答、得分:我的答案建在另外一个标签内,为简便请请直接新增)标答联动题库,得分表达式:IF(答案.转换==答案.标答,答案.标准分值,0)
方案二:7个以内选项设置,(对比方案一,可扩展性强,表达式相对复杂,结合方案一方便理解思维,解读表达式)
对比方案一,字表单多了两个控件:
1、“题干随机序号”(主控件需要对应设置,目的去除重复随机数)
2、“选项数”(联动题库。目的是根据选项数生成对应随机个数)
方案二核心字表单控件名称展示:
144357
主要控件“试题”函数表达式:CONCATENATE(试卷.题干,CHAR(10),"☚✻✼❄❅❆❇❈❉❊☛",CHAR(10),"A、",SPLIT(试卷.选项,",")-1],CHAR(10),"B、",SPLIT(试卷.选项,",")-1],CHAR(10),"C、",SPLIT(试卷.选项,",")-1],IFS(试卷.选项数>=4,CONCATENATE(CHAR(10),"D、",SPLIT(试卷.选项,",")-1])),IFS(试卷.选项数>=5,CONCATENATE(CHAR(10),"E、",SPLIT(试卷.选项,",")-1])),IFS(试卷.选项数>=6,CONCATENATE(CHAR(10),"F、",SPLIT(试卷.选项,",")-1])),IFS(试卷.选项数>=7,CONCATENATE(CHAR(10),"G、",SPLIT(试卷.选项,",")-1])))
144358
主要控件“选项随机”表达式:IFS(试卷.选项数==2,UNION(SPLIT(CONCATENATE(INT(RAND()*2+1),",",INT(RAND()*2+1)),","),"1","2"),试卷.选项数==3,UNION(SPLIT(CONCATENATE(INT(RAND()*3+1),",",INT(RAND()*3+1),",",INT(RAND()*3+1)),","),"1","2","3"),试卷.选项数==4,UNION(SPLIT(CONCATENATE(INT(RAND()*4+1),",",INT(RAND()*4+1),",",INT(RAND()*4+1),",",INT(RAND()*4+1)),","),"1","2","3","4"),试卷.选项数==5,UNION(SPLIT(CONCATENATE(INT(RAND()*5+1),",",INT(RAND()*5+1),",",INT(RAND()*5+1),",",INT(RAND()*5+1),",",INT(RAND()*5+1)),","),"1","2","3","4","5"),试卷.选项数==6,UNION(SPLIT(CONCATENATE(INT(RAND()*6+1),",",INT(RAND()*6+1),",",INT(RAND()*6+1),",",INT(RAND()*6+1),",",INT(RAND()*6+1),",",INT(RAND()*6+1)),","),"1","2","3","4","5","6"),试卷.选项数==7,UNION(SPLIT(CONCATENATE(INT(RAND()*7+1),",",INT(RAND()*7+1),",",INT(RAND()*7+1),",",INT(RAND()*7+1),",",INT(RAND()*7+1),",",INT(RAND()*7+1),",",INT(RAND()*7+1)),","),"1","2","3","4","5","6","7"))
选项随机支持7个以内选项,可以根据自己实际需要删减,注意理解数字对应关系。
由于选项随机,所以需要将选项结果做一个比对解读,“转换”控件表达式:IFS(ISEMPTY(试卷.单项选择)!=1,SPLIT(试卷.选项随机,","))。
我的答案建在另外一个标签内,如果一个标签内,可以直接赋值"得分“,完整表达式为IFS(IFS(ISEMPTY(试卷.单项选择)!=1,SPLIT(试卷.选项随机,","))==SEARCH(答案.标答,"ABCDEFG"),答案.标准分值),
控件”“题干”,“选项”,“选项数”,“标答”,“标准分值”,均为联动题库而来,随机数、题干随机序号公式参阅前面文档。单项选择为答题控件。
极简 极易 极完美,真正随机题库,完整链接体验:https://ub35s32n7x.jiandaoyun.com/f/60bf846ca0580d00075e3bd1
谢谢!