Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Use gid in an Equation to find the most recent date among Dates in a Group

  • stevenl
  • stevenl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 months 3 weeks ago - 7 months 3 weeks ago #246382 by stevenl
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition; Version 5.4.4+221004
Own server or LimeSurvey hosting: Unknown (company owned, I'm just an employee)
Survey theme/template: Custom Theme? I'm not sure
==================
I'm not sure if this will make sense...
Goal: Maybe I don't quite understand syntax well enough, but I was hoping to do something like: 
Code:
max(if(question_type is Date in this Group), then add the code to this max array)
The idea is that if more Date question types are later added (because they will be or sometimes taken away), they won't have to be added to the group manually.

Obstacles:
1) I can't find a way to reference group id.
2) Other than the max() array, I can't find a way to make a "generic" array to do this with, if need be.

Attempts to Parse the Group ID:
Code:
{G01Q29.gid}
Code:
{G01Q29.sgq}
Code:
{G01Q29.gseq}
Code:
{strpos("X",G01Q29.sgqa)}
Code:
{strpos(strpos("X",G01Q29.sgqa),G01Q29.sgqa)}
Code:
{if(this.type == "D","Y","N")}
Code:
{G01Q29.sgqa}
Code:
{str_replace("X",",",G01Q29.sgqa)}
Code:
{str_replace("X",",",G01Q29.sgqa)[2]}

We (other members of my team) didn't get far enough to even attempt the 2nd obstacle.

We did confirm that .type works to reference the question type though.

I've tried keyword searching "gid" and "group id" everywhere here, but found no documentation about how to get the Group ID, let alone the array stuff.

Please, help. All assistance is greatly appreciated. Ideally, syntax for an Equation type question is favorable, but if js is the only way to go, then that would be welcomed too.

Thank you all.
Last edit: 7 months 3 weeks ago by stevenl. Reason: note on a part that did work

Please Log in to join the conversation.

  • stevenl
  • stevenl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 months 3 weeks ago #250036 by stevenl
I guess I should also ask the community if this was the right place to post?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 3 weeks ago #250038 by Joffm
Whom else do you ask at the moment?

But at least you shgould send a lss export of this your try.

I fear, nobody (me too) understands your goal. 

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • stevenl
  • stevenl's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 months 3 weeks ago - 7 months 3 weeks ago #250047 by stevenl
I could, but none of it was actual stuff we'd use. So, I can recreate a group with several Date question types and load that here, but honestly, it's fairly simple. We were testing dummy surveys to see if we could do the thing listed in the goal.

Maybe reclarifying the goal might help?

Goal: A group with Date question types and other question types (like maybe Text Display or Radio Yes/No, etc) is checked to see which Date question type code has the most recent date, but only in that group.

On top of that (because dates will be changed constantly), have an equation that can be used to check for most recent date without having to edit the equation.

I'll post screen shots next, if this is still confusing.
Last edit: 7 months 3 weeks ago by stevenl. Reason: clarity

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose